Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add golang's top-level keywords to golang's stop words. #554

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading