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

📎 Remove dynamic registration for formatting from the LSP #1042

Closed
ematipico opened this issue Dec 4, 2023 · 0 comments · Fixed by #1104
Closed

📎 Remove dynamic registration for formatting from the LSP #1042

ematipico opened this issue Dec 4, 2023 · 0 comments · Fixed by #1104
Labels
A-LSP Area: language server protocol S-Enhancement Status: Improve an existing feature S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@ematipico
Copy link
Member

Description

At the moment, the formatting capabilities of the LSP are registered using dynamic capabilities:

capabilities.add_capability(
"biome_formatting",
"textDocument/formatting",
if self.session.is_linting_and_formatting_disabled() {
CapabilityStatus::Disable
} else {
CapabilityStatus::Enable(None)
},
);
capabilities.add_capability(
"biome_range_formatting",
"textDocument/rangeFormatting",
if self.session.is_linting_and_formatting_disabled() {
CapabilityStatus::Disable
} else {
CapabilityStatus::Enable(None)
},
);
capabilities.add_capability(
"biome_on_type_formatting",
"textDocument/onTypeFormatting",
if self.session.is_linting_and_formatting_disabled() {
CapabilityStatus::Disable
} else {
CapabilityStatus::Enable(Some(json!(DocumentOnTypeFormattingRegistrationOptions {
document_selector: None,
first_trigger_character: String::from("}"),
more_trigger_character: Some(vec![String::from("]"), String::from(")")]),
})))
},
);

This was done by leveraging the "update configuration and enable/disable" formatting, although this isn't needed because the workspace takes care of it. Plus, some LSP services out there don't support dynamic capabilities (or they do in a limited way).

We should remove the dynamic registration for formatting.

@ematipico ematipico added S-Help-wanted Status: you're familiar with the code base and want to help the project A-LSP Area: language server protocol S-Enhancement Status: Improve an existing feature labels Dec 4, 2023
@ematipico ematipico changed the title 📎 Remove dynamic registrato for formatting from the LSP 📎 Remove dynamic registration for formatting from the LSP Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LSP Area: language server protocol S-Enhancement Status: Improve an existing feature S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant