redhat-developer / redhat-developer/yaml-language-server
`rangeFormatting` is used to register whole-document `formatting` capability
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 352
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 11
Description
Describe the bug
The language server seems to be checking the wrong capability (rangeFormatting) to determine whether to dynamically register its whole-document formatting capability with the client.
There's an easy workaround (set a rangeFormatting capability on the client) but it's not immediately apparent without reading through the code.
clientDynamicRegisterSupport is set here based on the client's rangeFormatting capability:
https://github.com/redhat-developer/yaml-language-server/blob/6eda5f6168bb326883f5fd44508788c089d78b22/src/yamlServerInit.ts#L79-L83
But it's later used to dynamically register the whole-document formatting capability here:
https://github.com/redhat-developer/yaml-language-server/blob/0080b8c63d24e64be6dd1f759cfdb9a0d86c6d90/src/languageserver/handlers/settingsHandlers.ts#L162-L164
Thanks for all your work on this great project! 🙂
Expected Behavior
The language server should look at the client's formatting capability to determine whether to dynamically register its formatting capability
Current Behavior
The language server currently looks at the client's rangeFormatting capability to determine whether to dynamically register its formatting capability
Steps to Reproduce
- Create a client that registers the
formatting(notrangeFormatting) capability and observe that it never receives aclient/registerCapabilityrequest from the server - Change the client to register the
rangeFormattingcapability and observe that the sever then sends aclient/registerCapabilityrequest forformatting
Environment
- Windows
- Mac
- Linux
- other (please specify)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/yamlServerInit.ts at the clientDynamicRegisterSupport assignment, then compare its use in src/languageserver/handlers/settingsHandlers.ts. Confirm that the client's formatting capability controls dynamic registration, and verify the reproduction steps with formatting enabled but rangeFormatting disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100