Skip to content

Commit 31258db

Browse files
committed
fix(lsp): handle dynamic registration for didSave
Update server capabilities to set `save` to `None` when the client supports dynamic registration for `didSaveTextDocument`. This prevents redundant static registration and aligns with LSP specification.
1 parent 0adc11b commit 31258db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/lsp/capabilities.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ pub fn server_capabilities(config: &Config) -> ServerCapabilities {
3737
change: Some(TextDocumentSyncKind::INCREMENTAL),
3838
will_save: None,
3939
will_save_wait_until: None,
40-
save: Some(SaveOptions::default().into()),
40+
save: if config.caps().did_save_text_document_dynamic_registration() {
41+
None
42+
} else {
43+
Some(SaveOptions::default().into())
44+
},
4145
})),
4246
hover_provider: Some(HoverProviderCapability::Simple(true)),
4347
completion_provider: Some(CompletionOptions {

0 commit comments

Comments
 (0)