Skip to content

Commit

Permalink
feat: add golang's top-level keywords to golang's stop words. (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Oct 14, 2023
1 parent d22f51c commit 9dc5acb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/tabby/src/serve/completions/languages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down

0 comments on commit 9dc5acb

Please sign in to comment.