mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Auto merge of #13603 - Veykril:no-workspaces, r=Veykril
fix: Send status notification if there are no found workspaces Closes https://github.com/rust-lang/rust-analyzer/issues/5829
This commit is contained in:
commit
ff78d24e21
1 changed files with 16 additions and 3 deletions
|
@ -106,6 +106,14 @@ impl GlobalState {
|
||||||
status.health = lsp_ext::Health::Error;
|
status.health = lsp_ext::Health::Error;
|
||||||
status.message = Some(error)
|
status.message = Some(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.config.linked_projects().is_empty()
|
||||||
|
&& self.config.detached_files().is_empty()
|
||||||
|
&& self.config.notifications().cargo_toml_not_found
|
||||||
|
{
|
||||||
|
status.health = lsp_ext::Health::Warning;
|
||||||
|
status.message = Some("Workspace reload required".to_string())
|
||||||
|
}
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,9 +435,14 @@ impl GlobalState {
|
||||||
fn fetch_workspace_error(&self) -> Result<(), String> {
|
fn fetch_workspace_error(&self) -> Result<(), String> {
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
|
||||||
for ws in self.fetch_workspaces_queue.last_op_result() {
|
let last_op_result = self.fetch_workspaces_queue.last_op_result();
|
||||||
if let Err(err) = ws {
|
if last_op_result.is_empty() {
|
||||||
stdx::format_to!(buf, "rust-analyzer failed to load workspace: {:#}\n", err);
|
stdx::format_to!(buf, "rust-analyzer failed to discover workspace");
|
||||||
|
} else {
|
||||||
|
for ws in last_op_result {
|
||||||
|
if let Err(err) = ws {
|
||||||
|
stdx::format_to!(buf, "rust-analyzer failed to load workspace: {:#}\n", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue