Skip to content
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

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Dec 18, 2023

Fixes #15171

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 18, 2023
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.");
Copy link
Contributor

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?

Copy link
Member Author

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 :)

Comment on lines 177 to 192
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");
Copy link
Contributor

@davidbarsky davidbarsky Dec 18, 2023

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:

Suggested change
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 :)

@Veykril
Copy link
Member Author

Veykril commented Jan 2, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 2, 2024

📌 Commit 8136e73 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 2, 2024

⌛ Testing commit 8136e73 with merge 1a0b772...

@bors
Copy link
Collaborator

bors commented Jan 2, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 1a0b772 to master...

@bors bors merged commit 1a0b772 into rust-lang:master Jan 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When loading workspaces fails, tell the user if the linkedProjects config is set
4 participants