on master help sign in
Add `text` to language completer
commitcc47d3fb9d048b7fe2546409a492f27f6199adf5 authorA-Walrus <ofek.r.guy@gmail.com> dateMon 8 Aug 2022, 22:03 (4 years ago) parent01ee42b
1 file changed+10−4
helix-term/src/ui/mod.rs+10−4
helix-term/src/ui/mod.rs+10−4
@@ -330,13 +330,19 @@ pub mod completers {
330330 pub fn language(editor: &Editor, input: &str) -> Vec<Completion> {
331331 let matcher = Matcher::default();
332332
333− let mut matches: Vec<_> = editor
333+ let text: String = "text".into();
334+
335+ let language_ids = editor
334336 .syn_loader
335337 .language_configs()
336− .filter_map(|config| {
338+ .map(|config| &config.language_id)
339+ .chain(std::iter::once(&text));
340+
341+ let mut matches: Vec<_> = language_ids
342+ .filter_map(|language_id| {
337343 matcher
338− .fuzzy_match(&config.language_id, input)
339− .map(|score| (&config.language_id, score))
344+ .fuzzy_match(language_id, input)
345+ .map(|score| (language_id, score))
340346 })
341347 .collect();
342348