mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
fix: server hanging up on build script task
This commit is contained in:
parent
26a16c4d9b
commit
9dee352da0
3 changed files with 7 additions and 21 deletions
|
@ -301,19 +301,12 @@ impl GlobalState {
|
||||||
if let Some(path) = vfs_path.as_path() {
|
if let Some(path) = vfs_path.as_path() {
|
||||||
let path = path.to_path_buf();
|
let path = path.to_path_buf();
|
||||||
if reload::should_refresh_for_change(&path, file.kind()) {
|
if reload::should_refresh_for_change(&path, file.kind()) {
|
||||||
workspace_structure_change = Some((
|
workspace_structure_change = Some((path.clone(), false));
|
||||||
path.clone(),
|
|
||||||
false,
|
|
||||||
AsRef::<std::path::Path>::as_ref(&path).ends_with("build.rs"),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
if file.is_created_or_deleted() {
|
if file.is_created_or_deleted() {
|
||||||
has_structure_changes = true;
|
has_structure_changes = true;
|
||||||
workspace_structure_change = Some((
|
workspace_structure_change =
|
||||||
path,
|
Some((path, self.crate_graph_file_dependencies.contains(vfs_path)));
|
||||||
self.crate_graph_file_dependencies.contains(vfs_path),
|
|
||||||
false,
|
|
||||||
));
|
|
||||||
} else if path.extension() == Some("rs".as_ref()) {
|
} else if path.extension() == Some("rs".as_ref()) {
|
||||||
modified_rust_files.push(file.file_id);
|
modified_rust_files.push(file.file_id);
|
||||||
}
|
}
|
||||||
|
@ -365,16 +358,11 @@ impl GlobalState {
|
||||||
// FIXME: ideally we should only trigger a workspace fetch for non-library changes
|
// FIXME: ideally we should only trigger a workspace fetch for non-library changes
|
||||||
// but something's going wrong with the source root business when we add a new local
|
// but something's going wrong with the source root business when we add a new local
|
||||||
// crate see https://github.com/rust-lang/rust-analyzer/issues/13029
|
// crate see https://github.com/rust-lang/rust-analyzer/issues/13029
|
||||||
if let Some((path, force_crate_graph_reload, build_scripts_touched)) =
|
if let Some((path, force_crate_graph_reload)) = workspace_structure_change {
|
||||||
workspace_structure_change
|
|
||||||
{
|
|
||||||
self.fetch_workspaces_queue.request_op(
|
self.fetch_workspaces_queue.request_op(
|
||||||
format!("workspace vfs file change: {path}"),
|
format!("workspace vfs file change: {path}"),
|
||||||
force_crate_graph_reload,
|
force_crate_graph_reload,
|
||||||
);
|
);
|
||||||
if build_scripts_touched {
|
|
||||||
self.fetch_build_data_queue.request_op(format!("build.rs changed: {path}"), ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,7 @@ impl GlobalState {
|
||||||
let token = lsp_types::ProgressToken::String(
|
let token = lsp_types::ProgressToken::String(
|
||||||
cancel_token.unwrap_or_else(|| format!("rustAnalyzer/{title}")),
|
cancel_token.unwrap_or_else(|| format!("rustAnalyzer/{title}")),
|
||||||
);
|
);
|
||||||
|
tracing::debug!(?token, ?state, "report_progress {message:?}");
|
||||||
let work_done_progress = match state {
|
let work_done_progress = match state {
|
||||||
Progress::Begin => {
|
Progress::Begin => {
|
||||||
self.send_request::<lsp_types::request::WorkDoneProgressCreate>(
|
self.send_request::<lsp_types::request::WorkDoneProgressCreate>(
|
||||||
|
|
|
@ -411,10 +411,7 @@ impl GlobalState {
|
||||||
if *force_reload_crate_graph {
|
if *force_reload_crate_graph {
|
||||||
self.recreate_crate_graph(cause);
|
self.recreate_crate_graph(cause);
|
||||||
}
|
}
|
||||||
if self.build_deps_changed && self.config.run_build_scripts() {
|
|
||||||
self.build_deps_changed = false;
|
|
||||||
self.fetch_build_data_queue.request_op("build_deps_changed".to_owned(), ());
|
|
||||||
}
|
|
||||||
// Current build scripts do not match the version of the active
|
// Current build scripts do not match the version of the active
|
||||||
// workspace, so there's nothing for us to update.
|
// workspace, so there's nothing for us to update.
|
||||||
return;
|
return;
|
||||||
|
@ -424,7 +421,7 @@ impl GlobalState {
|
||||||
|
|
||||||
// Here, we completely changed the workspace (Cargo.toml edit), so
|
// Here, we completely changed the workspace (Cargo.toml edit), so
|
||||||
// we don't care about build-script results, they are stale.
|
// we don't care about build-script results, they are stale.
|
||||||
// FIXME: can we abort the build scripts here?
|
// FIXME: can we abort the build scripts here if they are already running?
|
||||||
self.workspaces = Arc::new(workspaces);
|
self.workspaces = Arc::new(workspaces);
|
||||||
|
|
||||||
if self.config.run_build_scripts() {
|
if self.config.run_build_scripts() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue