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

`rangeFormatting` is used to register whole-document `formatting` capability

Open Beginner friendly
#932 0 comments 0 reactions 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

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

  1. Create a client that registers the formatting (not rangeFormatting) capability and observe that it never receives a client/registerCapability request from the server
  2. Change the client to register the rangeFormatting capability and observe that the sever then sends a client/registerCapability request for formatting

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

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/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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.