Return None
when prepare rename is not available on language server
This commit is contained in:
parent
b355b5c1fb
commit
f91fdd2ba0
2 changed files with 12 additions and 0 deletions
|
@ -292,6 +292,10 @@ impl LanguageServer {
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
rename: Some(RenameClientCapabilities {
|
||||||
|
prepare_support: Some(true),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
experimental: Some(json!({
|
experimental: Some(json!({
|
||||||
|
|
|
@ -86,6 +86,14 @@ impl LspCommand for PrepareRename {
|
||||||
type LspRequest = lsp::request::PrepareRenameRequest;
|
type LspRequest = lsp::request::PrepareRenameRequest;
|
||||||
type ProtoRequest = proto::PrepareRename;
|
type ProtoRequest = proto::PrepareRename;
|
||||||
|
|
||||||
|
fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool {
|
||||||
|
if let Some(lsp::OneOf::Right(rename)) = &capabilities.rename_provider {
|
||||||
|
rename.prepare_provider == Some(true)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn to_lsp(&self, path: &Path, _: &AppContext) -> lsp::TextDocumentPositionParams {
|
fn to_lsp(&self, path: &Path, _: &AppContext) -> lsp::TextDocumentPositionParams {
|
||||||
lsp::TextDocumentPositionParams {
|
lsp::TextDocumentPositionParams {
|
||||||
text_document: lsp::TextDocumentIdentifier {
|
text_document: lsp::TextDocumentIdentifier {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue