@@ -7,8 +7,9 @@ use crate::{
77use helix_core::{find_workspace, path, syntax::LanguageServerFeature, ChangeSet, Rope};
88use helix_loader::{self, VERSION_AND_GIT_HASH};
99use lsp::{
10− notification::DidChangeWorkspaceFolders, DidChangeWorkspaceFoldersParams, OneOf,
11− PositionEncodingKind, WorkspaceFolder, WorkspaceFoldersChangeEvent,
10+ notification::DidChangeWorkspaceFolders, CodeActionCapabilityResolveSupport,
11+ DidChangeWorkspaceFoldersParams, OneOf, PositionEncodingKind, WorkspaceFolder,
12+ WorkspaceFoldersChangeEvent,
1213};
1314use lsp_types as lsp;
1415use parking_lot::Mutex;
@@ -609,6 +610,12 @@ impl Client {
609610 .collect(),
610611 },
611612 }),
613+ is_preferred_support: Some(true),
614+ disabled_support: Some(true),
615+ data_support: Some(true),
616+ resolve_support: Some(CodeActionCapabilityResolveSupport {
617+ properties: vec!["edit".to_owned(), "command".to_owned()],
618+ }),
612619 ..Default::default()
613620 }),
614621 publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
@@ -954,6 +961,24 @@ impl Client {
954961 Some(self.call::<lsp::request::ResolveCompletionItem>(completion_item))
955962 }
956963
964+ pub fn resolve_code_action(
965+ &self,
966+ code_action: lsp::CodeAction,
967+ ) -> Option<impl Future<Output = Result<Value>>> {
968+ let capabilities = self.capabilities.get().unwrap();
969+
970+ // Return early if the server does not support resolving code action.
971+ match capabilities.completion_provider {
972+ Some(lsp::CompletionOptions {
973+ resolve_provider: Some(true),
974+ ..
975+ }) => (),
976+ _ => return None,
977+ }
978+
979+ Some(self.call::<lsp::request::CodeActionResolveRequest>(code_action))
980+ }
981+
957982 pub fn text_document_signature_help(
958983 &self,
959984 text_document: lsp::TextDocumentIdentifier,