diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 38507e4dd1cb3..927718654c751 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -325,6 +325,16 @@ pub fn symbol_picker(cx: &mut Context) { let doc = doc!(cx.editor); let language_server = language_server!(cx.editor, doc); + + if matches!( + language_server.capabilities().workspace_symbol_provider, + None | Some(lsp::OneOf::Left(false)) + ) { + cx.editor + .set_status("Document symbols are not enabled by the Language Server"); + return; + } + let current_url = doc.url(); let offset_encoding = language_server.offset_encoding(); @@ -359,6 +369,16 @@ pub fn workspace_symbol_picker(cx: &mut Context) { let doc = doc!(cx.editor); let current_url = doc.url(); let language_server = language_server!(cx.editor, doc); + + if matches!( + language_server.capabilities().workspace_symbol_provider, + None | Some(lsp::OneOf::Left(false)) + ) { + cx.editor + .set_status("Workspace symbols are not enabled by the Language Server"); + return; + } + let offset_encoding = language_server.offset_encoding(); let future = language_server.workspace_symbols("".to_string()); @@ -426,6 +446,15 @@ pub fn code_action(cx: &mut Context) { let language_server = language_server!(cx.editor, doc); + if matches!( + language_server.capabilities().code_action_provider, + None | Some(lsp::CodeActionProviderCapability::Simple(false)) + ) { + cx.editor + .set_status("Code actions are not enabled by the Language Server"); + return; + } + let selection_range = doc.selection(view.id).primary(); let offset_encoding = language_server.offset_encoding(); @@ -737,6 +766,16 @@ fn to_locations(definitions: Option) -> Vec