-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Notify user that linkedProjects is set when failing to discover projects #16153
Conversation
crates/rust-analyzer/src/reload.rs
Outdated
message.push_str("Failed to load workspaces.\n\n"); | ||
message.push_str("Failed to load workspaces."); | ||
if self.config.has_linked_projects() { | ||
message.push_str(" Note that linked projects have been specified, it looks like this setting has been misconfigured."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's alright with you, I've hacked together a change to this that includes the paths of which linked projects have been specified. Would you want to me push to a separate PR with that change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to PR that instead. I didn't bother putting much effort into this (just noticed I still had myself assigned to the issue :)
crates/rust-analyzer/src/reload.rs
Outdated
message.push_str("Failed to load workspaces."); | ||
if self.config.has_linked_projects() { | ||
message.push_str(" Note that linked projects have been specified, it looks like this setting has been misconfigured."); | ||
} | ||
message.push_str("\n\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, realized that it can be:
message.push_str("Failed to load workspaces."); | |
if self.config.has_linked_projects() { | |
message.push_str(" Note that linked projects have been specified, it looks like this setting has been misconfigured."); | |
} | |
message.push_str("\n\n"); | |
message.push_str("Failed to load workspaces."); | |
if self.config.has_linked_projects() { | |
let linked_projects = self.config.linked_projects(); | |
let (manifest_paths, inline_projects): (Vec<_>, Vec<_>) = | |
linked_projects.iter().partition(|linked_project| { | |
matches!(linked_project, LinkedProject::ProjectManifest(..)) | |
}); | |
message.push_str( | |
"`rust-analyzer.linkedprojects` have been specified, which may cause indexing failures.\n\n ", | |
); | |
if !manifest_paths.is_empty() { | |
let paths = format!("paths to projects: {:?}", manifest_paths); | |
message.push_str(&paths) | |
} | |
match inline_projects.len() { | |
0 => (), | |
1 => message.push_str( | |
"The contents of the linked project were redacted due to its length.", | |
), | |
_ => message.push_str( | |
"The contents of the linked projects were redacted due to its length.", | |
), | |
}; | |
} |
feel free to take it or leave it :)
@bors r+ |
☀️ Test successful - checks-actions |
Fixes #15171