Auto merge of #14366 - Veykril:linked-proj, r=Veykril

feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects

cc https://github.com/rust-lang/rust-analyzer/issues/13226 https://github.com/rust-lang/rust-analyzer/issues/9661
This commit is contained in:
bors 2023-03-28 07:05:43 +00:00
commit 5bba438c9c
6 changed files with 74 additions and 15 deletions

View file

@ -337,7 +337,7 @@ impl GlobalState {
}
pub(crate) fn send_notification<N: lsp_types::notification::Notification>(
&mut self,
&self,
params: N::Params,
) {
let not = lsp_server::Notification::new(N::METHOD.to_string(), params);
@ -378,7 +378,7 @@ impl GlobalState {
self.req_queue.incoming.is_completed(&request.id)
}
fn send(&mut self, message: lsp_server::Message) {
fn send(&self, message: lsp_server::Message) {
self.sender.send(message).unwrap()
}
}

View file

@ -120,7 +120,8 @@ impl GlobalState {
&& self.config.notifications().cargo_toml_not_found
{
status.health = lsp_ext::Health::Warning;
message.push_str("Failed to discover workspace.\n\n");
message.push_str("Failed to discover workspace.\n");
message.push_str("Consider adding the `Cargo.toml` of the workspace to the [`linkedProjects`](https://rust-analyzer.github.io/manual.html#rust-analyzer.linkedProjects) setting.\n\n");
}
for ws in self.workspaces.iter() {