diff options
author | Nathan Vegdahl | 2021-07-26 18:19:10 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-26 18:19:10 +0000 |
commit | f62ec6e51e99dce9e93600801c3637c196c592b6 (patch) | |
tree | 8821ee23ade21c0da4fbb5a70143717ac42a2bc1 /helix-lsp | |
parent | 5ee6ba5b38ebeb86006bb2e42734a2285eb354df (diff) | |
parent | 88d6f652390922b389667f469b6d308db569bdaf (diff) |
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-lsp')
-rw-r--r-- | helix-lsp/src/client.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 1c2a49b5..fd34f45d 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -247,6 +247,26 @@ impl Client { content_format: Some(vec![lsp::MarkupKind::Markdown]), ..Default::default() }), + code_action: Some(lsp::CodeActionClientCapabilities { + code_action_literal_support: Some(lsp::CodeActionLiteralSupport { + code_action_kind: lsp::CodeActionKindLiteralSupport { + value_set: [ + lsp::CodeActionKind::EMPTY, + lsp::CodeActionKind::QUICKFIX, + lsp::CodeActionKind::REFACTOR, + lsp::CodeActionKind::REFACTOR_EXTRACT, + lsp::CodeActionKind::REFACTOR_INLINE, + lsp::CodeActionKind::REFACTOR_REWRITE, + lsp::CodeActionKind::SOURCE, + lsp::CodeActionKind::SOURCE_ORGANIZE_IMPORTS, + ] + .iter() + .map(|kind| kind.as_str().to_string()) + .collect(), + }, + }), + ..Default::default() + }), ..Default::default() }), window: Some(lsp::WindowClientCapabilities { @@ -713,4 +733,31 @@ impl Client { self.call::<lsp::request::DocumentSymbolRequest>(params) } + + // empty string to get all symbols + pub fn workspace_symbols(&self, query: String) -> impl Future<Output = Result<Value>> { + let params = lsp::WorkspaceSymbolParams { + query, + work_done_progress_params: lsp::WorkDoneProgressParams::default(), + partial_result_params: lsp::PartialResultParams::default(), + }; + + self.call::<lsp::request::WorkspaceSymbol>(params) + } + + pub fn code_actions( + &self, + text_document: lsp::TextDocumentIdentifier, + range: lsp::Range, + ) -> impl Future<Output = Result<Value>> { + let params = lsp::CodeActionParams { + text_document, + range, + context: lsp::CodeActionContext::default(), + work_done_progress_params: lsp::WorkDoneProgressParams::default(), + partial_result_params: lsp::PartialResultParams::default(), + }; + + self.call::<lsp::request::CodeActionRequest>(params) + } } |