fix: Updating settings should not clobber discovered projects #18059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
linkedProjects
is owned by the user's configuration, so when users update this setting,linkedProjects
is reset. This is problematic whenlinkedProjects
also contains projects discovered withdiscoverCommand
.The buggy behaviour occurred when:
(1) The user configures
discoverCommand
and loads a Rust project.(2) The user changes any setting in VS Code, so rust-analyzer receives
workspace/didChangeConfiguration
.(3)
handle_did_change_configuration
ultimately callsClient::apply_change_with_sink()
, which updatesconfig.user_config
and discards any items we added inlinkedProjects
.Instead, separate out
discovered_projects_from_filesystem
anddiscovered_projects_from_command
from user configuration, so user settings cannot affect any type of discovered project.This fixes the subtle issue mentioned here: #17246 (comment)