aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorA-Walrus2022-08-08 19:03:41 +0000
committerBlaž Hrastnik2022-09-10 13:23:38 +0000
commitcc47d3fb9d048b7fe2546409a492f27f6199adf5 (patch)
tree4bf3632637a61dfc49b9a200fdb98e41e395799d /helix-term
parent01ee42bb149adee2fe17561806d9525370c84ef4 (diff)
Add `text` to language completer
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 01ffe243..60ad3b24 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -330,13 +330,19 @@ pub mod completers {
pub fn language(editor: &Editor, input: &str) -> Vec<Completion> {
let matcher = Matcher::default();
- let mut matches: Vec<_> = editor
+ let text: String = "text".into();
+
+ let language_ids = editor
.syn_loader
.language_configs()
- .filter_map(|config| {
+ .map(|config| &config.language_id)
+ .chain(std::iter::once(&text));
+
+ let mut matches: Vec<_> = language_ids
+ .filter_map(|language_id| {
matcher
- .fuzzy_match(&config.language_id, input)
- .map(|score| (&config.language_id, score))
+ .fuzzy_match(language_id, input)
+ .map(|score| (language_id, score))
})
.collect();