redhat-developer / redhat-developer/yaml-language-server

Don't send workspace/configuration to clients that don't support it

Open
#927 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

https://github.com/redhat-developer/yaml-language-server/blob/3a74bdc22a1ae8a752e89cbf32616eacae163cea/src/languageserver/handlers/settingsHandlers.ts#L41

This function call (AFAICT) sends workspace/configuration, but it is called in response to workspace/didChangeConfiguration: https://github.com/redhat-developer/yaml-language-server/blob/3a74bdc22a1ae8a752e89cbf32616eacae163cea/src/languageserver/handlers/settingsHandlers.ts#L34. But that event should already give you the whole configuration!

Worse, the workspace/configuration request is sent to clients that don't support it. For example, I know that ALE (a Vim LSP client) prefers to use the workspace/didChangeConfiguration notification and does not support workspace/configuration, which it indicates by initializing with workspace.configuration capability false.


Essentially, this breaks using yaml-language-server with (for example) custom schema configuration because that configuration is never seen by the server.

I don't know if this could be a bug in the vscode-languageserver Node library, but it seems that sending workspace/configuration in response to the workspace/didChangeConfiguration notification is an anti-pattern.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/languageserver/handlers/settingsHandlers.ts around lines 34 and 41, then inspect how the server handles workspace/didChangeConfiguration and the client's workspace.configuration capability. Reproduce the custom schema configuration case with a client such as ALE; done means unsupported clients are not sent workspace/configuration and their configuration is still seen by the server.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.