Use autoreload config to gate execution rather that staleness
This commit is contained in:
parent
3698b3eab8
commit
e3c47ccefc
@ -454,7 +454,9 @@ fn handle_event(&mut self, event: Event) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
if self.config.cargo_autoreload() {
|
||||
self.fetch_workspaces_if_needed();
|
||||
}
|
||||
self.fetch_build_data_if_needed();
|
||||
|
||||
let loop_duration = loop_start.elapsed();
|
||||
@ -494,7 +496,10 @@ fn on_request(&mut self, request_received: Instant, req: Request) -> Result<()>
|
||||
}
|
||||
|
||||
RequestDispatcher { req: Some(req), global_state: self }
|
||||
.on_sync::<lsp_ext::ReloadWorkspace>(|s, ()| Ok(s.fetch_workspaces_request()))?
|
||||
.on_sync::<lsp_ext::ReloadWorkspace>(|s, ()| {
|
||||
self.fetch_workspaces_request();
|
||||
self.fetch_workspaces_if_needed();
|
||||
})?
|
||||
.on_sync::<lsp_ext::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
|
||||
.on_sync::<lsp_ext::OnEnter>(|s, p| handlers::handle_on_enter(s.snapshot(), p))?
|
||||
.on_sync::<lsp_types::request::Shutdown>(|s, ()| {
|
||||
|
@ -60,11 +60,7 @@ pub(crate) fn maybe_refresh(&mut self, changes: &[(AbsPathBuf, ChangeKind)]) {
|
||||
", "
|
||||
)
|
||||
);
|
||||
if self.config.cargo_autoreload() {
|
||||
self.fetch_workspaces_request();
|
||||
} else {
|
||||
self.transition(Status::NeedsReload);
|
||||
}
|
||||
|
||||
fn is_interesting(path: &AbsPath, change_kind: ChangeKind) -> bool {
|
||||
const IMPLICIT_TARGET_FILES: &[&str] = &["build.rs", "src/main.rs", "src/lib.rs"];
|
||||
|
Loading…
Reference in New Issue
Block a user