aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorPhilipp Mildenberger2023-03-20 16:44:04 +0000
committerPhilipp Mildenberger2023-05-18 19:58:17 +0000
commitff262084271492bba239dbc2e5788be3c4d5a4e5 (patch)
tree0c668cc05e1757377fa3cd418921c9ee575da350 /helix-term/src/ui
parent9d089c27c77cb2797a0495b46477dfe348d09a91 (diff)
Filter language servers also by capabilities in `doc.language_servers_with_feature`
* Add `helix_lsp::client::Client::supports_feature(&self, LanguageServerFeature)` * Extend `doc.language_servers_with_feature` to use this method as filter as well * Add macro `language_server_with_feature!` to reduce boilerplate for non-mergeable language server requests (like goto-definition) * Refactored most of the `find_map` code to use the either the macro or filter directly via `doc.language_servers_with_feature`
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/mod.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 6f7ed174..ec328ec5 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -394,14 +394,11 @@ pub mod completers {
pub fn lsp_workspace_command(editor: &Editor, input: &str) -> Vec<Completion> {
let matcher = Matcher::default();
- let options = match doc!(editor)
+ let Some(options) = doc!(editor)
.language_servers_with_feature(LanguageServerFeature::WorkspaceCommand)
.find_map(|ls| ls.capabilities().execute_command_provider.as_ref())
- {
- Some(options) => options,
- None => {
- return vec![];
- }
+ else {
+ return vec![];
};
let mut matches: Vec<_> = options