lsp: Add support for dynamic registration of rename capability (#25610)
While looking at Biome LSP implementation I've noticed that they register their rename capability dynamically, which we don't handle. Release Notes: - N/A
This commit is contained in:
parent
198f56c763
commit
3db18ff053
1 changed files with 27 additions and 0 deletions
|
@ -663,6 +663,30 @@ impl LocalLspStore {
|
||||||
"workspace/didChangeConfiguration" => {
|
"workspace/didChangeConfiguration" => {
|
||||||
// Ignore payload since we notify clients of setting changes unconditionally, relying on them pulling the latest settings.
|
// Ignore payload since we notify clients of setting changes unconditionally, relying on them pulling the latest settings.
|
||||||
}
|
}
|
||||||
|
"textDocument/rename" => {
|
||||||
|
this.update(&mut cx, |this, _| {
|
||||||
|
if let Some(server) = this.language_server_for_id(server_id)
|
||||||
|
{
|
||||||
|
let options = reg
|
||||||
|
.register_options
|
||||||
|
.map(|options| {
|
||||||
|
serde_json::from_value::<lsp::RenameOptions>(
|
||||||
|
options,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.transpose()?;
|
||||||
|
let options = match options {
|
||||||
|
None => OneOf::Left(true),
|
||||||
|
Some(options) => OneOf::Right(options),
|
||||||
|
};
|
||||||
|
|
||||||
|
server.update_capabilities(|capabilities| {
|
||||||
|
capabilities.rename_provider = Some(options);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
anyhow::Ok(())
|
||||||
|
})??;
|
||||||
|
}
|
||||||
_ => log::warn!("unhandled capability registration: {reg:?}"),
|
_ => log::warn!("unhandled capability registration: {reg:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -689,6 +713,9 @@ impl LocalLspStore {
|
||||||
Some(())
|
Some(())
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
"workspace/didChangeConfiguration" => {
|
||||||
|
// Ignore payload since we notify clients of setting changes unconditionally, relying on them pulling the latest settings.
|
||||||
|
}
|
||||||
"textDocument/rename" => {
|
"textDocument/rename" => {
|
||||||
this.update(&mut cx, |this, _| {
|
this.update(&mut cx, |this, _| {
|
||||||
if let Some(server) = this.language_server_for_id(server_id)
|
if let Some(server) = this.language_server_for_id(server_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue