Query workspace for active document when we are not passed a project context in an LSP request #54397
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.
In only-LSP scenarios, LSP determines the project context when the LSP navbar is active. LSP is able to handle dropdownbar events, query the server for all project contexts, and then handle selection events when the user switches the context.
However, we are not able to enable the LSP NavBar in classic scenarios due to missing features (code generation, multiple ranges, missing icons, etc). So for LSP pull diagnostics in classic, the LSP client does not know which project context is active as Roslyn is handling all NavBar integration (outside of LSP). Per conversations with the editor, the lsp client is not easily able to query for the active dropdown and convert that result into the project context needed to pass with LSP pull diagnostics requests.
The result of this issue is that LSP pull diagnostics currently does not return errors for the correct context. It arbitrarily picks the first project context ( can result in incorrect squiggles). To temporarily solve this issue, we can query the workspace for the document in the current context.
I am also in favor of blocking enabling additional LSP features in classic scenarios on full LSP navbar support. This should only be used for the diagnostics experiment.