fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Use normalizeLanguage to properly map langs (#593)

author
Auguste Rame
committer
GitHub
date (Jun 13, 2023, 11:41 PM -0400) commit 68aa74e2 parent b8b67221
+16 -1
+16 -1
build/ctags.go
··· 17 17 import ( 18 18 "bytes" 19 19 "fmt" 20 + "strings" 20 21 21 22 "github.com/sourcegraph/zoekt" 22 23 "github.com/sourcegraph/zoekt/ctags" 23 24 ) 24 25 26 + // Make sure all names are lowercase here, since they are normalized 27 + var enryLanguageMappings = map[string]string{ 28 + "c#": "c_sharp", 29 + } 30 + 31 + func normalizeLanguage(filetype string) string { 32 + normalized := strings.ToLower(filetype) 33 + if mapped, ok := enryLanguageMappings[normalized]; ok { 34 + normalized = mapped 35 + } 36 + 37 + return normalized 38 + } 39 + 25 40 func ctagsAddSymbolsParserMap(todo []*zoekt.Document, languageMap ctags.LanguageMap, parserMap ctags.ParserMap) error { 26 41 for _, doc := range todo { 27 42 if doc.Symbols != nil { ··· 30 45 31 46 zoekt.DetermineLanguageIfUnknown(doc) 32 47 33 - parserKind := languageMap[doc.Language] 48 + parserKind := languageMap[normalizeLanguage(doc.Language)] 34 49 if parserKind == ctags.NoCTags { 35 50 continue 36 51 }