From 9dc5acb62e287e6c1e43bdda7ee9d680e8b2b687 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Sat, 14 Oct 2023 00:42:26 -0700 Subject: [PATCH] feat: add golang's top-level keywords to golang's stop words. (#554) --- .../tabby/src/serve/completions/languages.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/tabby/src/serve/completions/languages.rs b/crates/tabby/src/serve/completions/languages.rs index 44d2e65c6ce4..8eebce9af76c 100644 --- a/crates/tabby/src/serve/completions/languages.rs +++ b/crates/tabby/src/serve/completions/languages.rs @@ -69,6 +69,24 @@ lazy_static! { stop_words: &JAVASCRIPT_TYPESCRIPT_STOP_WORDS, line_comment: "//", }; + + /* Golang */ + static ref GO_STOP_WORDS: Vec<&'static str> = vec![ + "\n//", + "\nfunc", + "\ninterface", + "\nstruct", + "\npackage", + "\ntype", + "\nimport", + "\nvar", + "\nconst", + ] + .with_default(); + static ref GO: Language = Language { + stop_words: &GO_STOP_WORDS, + line_comment: "//", + }; } pub fn get_language(language: &str) -> &'static Language { @@ -78,6 +96,8 @@ pub fn get_language(language: &str) -> &'static Language { &RUST } else if language == "javascript" || language == "typescript" { &JAVASCRIPT_TYPESCRIPT + } else if language == "go" { + &GO } else { &UNKONWN }