Skip to content
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

rangeFormatting is used to register whole-document formatting capability #932

Open
1 of 4 tasks
elliotfklein opened this issue Oct 18, 2023 · 0 comments
Open
1 of 4 tasks

Comments

@elliotfklein
Copy link

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:

this.yamlSettings.clientDynamicRegisterSupport = !!(
this.yamlSettings.capabilities.textDocument &&
this.yamlSettings.capabilities.textDocument.rangeFormatting &&
this.yamlSettings.capabilities.textDocument.rangeFormatting.dynamicRegistration
);

But it's later used to dynamically register the whole-document formatting capability here:

this.yamlSettings.formatterRegistration = this.connection.client.register(DocumentFormattingRequest.type, {
documentSelector: [{ language: 'yaml' }],
});

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant