Check for rename support before showing LSP rename prompt (#9277)

This commit is contained in:
Michael Davis 2024-01-08 19:55:11 -05:00 committed by GitHub
parent 4da6191a1c
commit 0cbd8d3df1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1421,6 +1421,16 @@ pub fn rename_symbol(cx: &mut Context) {
let (view, doc) = current_ref!(cx.editor); let (view, doc) = current_ref!(cx.editor);
if doc
.language_servers_with_feature(LanguageServerFeature::RenameSymbol)
.next()
.is_none()
{
cx.editor
.set_error("No configured language server supports symbol renaming");
return;
}
let language_server_with_prepare_rename_support = doc let language_server_with_prepare_rename_support = doc
.language_servers_with_feature(LanguageServerFeature::RenameSymbol) .language_servers_with_feature(LanguageServerFeature::RenameSymbol)
.find(|ls| { .find(|ls| {