-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust analyzer options don't apply in VS Code until restart or settings refresh #3924
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
Comments
The problem is that the server updates its config with some latency. I'll go for the proper solution, bear with me. |
Well, this is not that easy as I've expected. The problem is with the config update protocol. The server queries the config in a separate request right after receiving the notification according to our implementation. Only after that, we can consider the server to have the up-to-date config. The pull model doesn't allow fixing this sync problem. We cannot wait for the notification response from the server and we can not wait until the server receives the configuration response. I think we are left only with the workaround of adding a |
… backend See the explanation in the issue comment: rust-lang#3924 (comment)
Interesting, thanks for writing the description of the issue. I'm not sure I understand what's going on.
What I observe is that in step 4 above, server reads Config1 instead of Config2.
Thanks! |
Just writing for my own clarification:
We need a way to ensure step 4. doesn't race with 5. which is what the Sleep(10) you added would do in some cases. 4. should execute after 5. |
@nokola sorry for spitting the technical details, these are for the fellow contributors actually. I've already created a workaround PR #3948 Since you are curious, the problem is with the pull-based configuration update model that language server protocol introduced in microsoft/language-server-protocol#299 So the current workflow is:
With this workflow, the vscode extension doesn't know the exact time when the step 5 happened so that it can refresh the inlay hints. So I've just added a heuristic 10 ms latency before updating the inlay hints, so that we give the language server the time to update its config. |
Thanks for the detailed explanation! I just downloaded rust-analyzer's code yesterday and still learning about it.
In the above flow, we keep the pull model, it's just that the server ensures it always has the latest config when it starts handling a request. Another possible fix: treat the configuration settings as "world stopping for a short time" in the server:
What is your opinion? (also if you have no time to answer a noob question, np! I can look at the source!) Edit: train of thought: it looks like the server executes requests out of order, when in the case of config update, all requests sent after the config update should execute after the config update in the server. Interesting, this is similar to a memory fence in multithreading. |
… backend See the explanation in the issue comment: rust-lang#3924 (comment)
… backend See the explanation in the issue comment: rust-lang/rust-analyzer#3924 (comment)
3948: fix: inlay hints config desyncronization between the frontend and the backend r=matklad a=Veetaha See the explanation in the issue comment: rust-lang/rust-analyzer#3924 (comment) Workaround-ly fixes: #3924 Co-authored-by: veetaha <[email protected]>
VS Code stable 1.44.0 + rust-analyzer: nightly (080c983) 2020-04-08
Steps to reproduce
Install whatever is required from rust analyzer. Wait for inlay hints to show up.

They show up OK:
Open Settings, add the below and save:
Observed:
parameter inlay hints stay incorrectly

Expected:
parameter inlay hints disappear
Notes
Update some unrelated settings e.g. change the

underline
fontStyle to 'bold' and save settings, inlay hints will pick up.Very confusing issue especially if settings updated through UI checkboxes (Ctrl+,)
VS Code:
Version: 1.44.0 (user setup)
Commit: 2aae1f26c72891c399f860409176fe435a154b13
Date: 2020-04-07T23:31:18.860Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363
The text was updated successfully, but these errors were encountered: