fix: Updating settings should not clobber discovered projects#18059
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 6, 2024
Merged
fix: Updating settings should not clobber discovered projects#18059bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
`linkedProjects` is owned by the user's configuration, so when users update this setting, `linkedProjects` is reset. This is problematic when `linkedProjects` also contains projects discovered with `discoverCommand`. 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 calls `Client::apply_change_with_sink()`, which updates `config.user_config` and discards any items we added in `linkedProjects`. Instead, separate out `discovered_projects_from_filesystem` and `discovered_projects_from_command` from user configuration, so user settings cannot affect any type of discovered project. This fixes the subtle issue mentioned here: rust-lang#17246 (comment)
b3d6a83 to
3cf28f1
Compare
Veykril
approved these changes
Sep 6, 2024
Member
|
@bors r+ |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
linkedProjectsis owned by the user's configuration, so when users update this setting,linkedProjectsis reset. This is problematic whenlinkedProjectsalso contains projects discovered withdiscoverCommand.The buggy behaviour occurred when:
(1) The user configures
discoverCommandand loads a Rust project.(2) The user changes any setting in VS Code, so rust-analyzer receives
workspace/didChangeConfiguration.(3)
handle_did_change_configurationultimately callsClient::apply_change_with_sink(), which updatesconfig.user_configand discards any items we added inlinkedProjects.Instead, separate out
discovered_projects_from_filesystemanddiscovered_projects_from_commandfrom user configuration, so user settings cannot affect any type of discovered project.This fixes the subtle issue mentioned here: #17246 (comment)