From 31ed5b9d0187270a6c1034016e81df6816ba8107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Henrique=20Guard=C3=A3o=20Gandarez?= Date: Tue, 17 Sep 2024 10:39:49 -0300 Subject: [PATCH 1/3] Bump Chroma to v2.12.0 --- go.mod | 5 +---- go.sum | 6 ++---- pkg/heartbeat/language.go | 21 +++++++++++++++++++++ pkg/heartbeat/language_test.go | 3 +++ pkg/language/chroma.go | 1 + pkg/language/language_test.go | 14 +++++++------- pkg/lexer/delphi.go | 4 ++-- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 6ff11ba1..03b93a1d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.5 require ( github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 github.com/alecthomas/assert v1.0.0 - github.com/alecthomas/chroma/v2 v2.10.0 + github.com/alecthomas/chroma/v2 v2.12.0 github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 github.com/dlclark/regexp2 v1.10.0 github.com/gandarez/go-olson-timezone v0.1.0 @@ -55,7 +55,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -// replace github.com/alecthomas/chroma/v2 => github.com/gandarez/chroma/v2 v2.9.1-wakatime.1 -// replace github.com/alecthomas/chroma/v2 => /Users/gandarez/development/git/gandarez/chroma - replace github.com/matishsiao/goInfo => github.com/wakatime/goInfo v0.1.0-wakatime.9 diff --git a/go.sum b/go.sum index aa425f6b..ae3cd63e 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/alecthomas/assert v1.0.0 h1:3XmGh/PSuLzDbK3W2gUbRXwgW5lqPkuqvRgeQ30FI github.com/alecthomas/assert v1.0.0/go.mod h1:va/d2JC+M7F6s+80kl/R3G7FUiW6JzUO+hPhLyJ36ZY= github.com/alecthomas/assert/v2 v2.2.1 h1:XivOgYcduV98QCahG8T5XTezV5bylXe+lBxLG2K2ink= github.com/alecthomas/assert/v2 v2.2.1/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/chroma/v2 v2.10.0 h1:T2iQOCCt4pRmRMfL55gTodMtc7cU0y7lc1Jb8/mK/64= -github.com/alecthomas/chroma/v2 v2.10.0/go.mod h1:4TQu7gdfuPjSh76j78ietmqh9LiurGF0EpseFXdKMBw= +github.com/alecthomas/chroma/v2 v2.12.0 h1:Wh8qLEgMMsN7mgyG8/qIpegky2Hvzr4By6gEF7cmWgw= +github.com/alecthomas/chroma/v2 v2.12.0/go.mod h1:4TQu7gdfuPjSh76j78ietmqh9LiurGF0EpseFXdKMBw= github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk= github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= @@ -268,8 +268,6 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/wakatime/goInfo v0.1.0-wakatime.8 h1:MgyeRnCkynEmUxLKXnYUAP5Dd+vhKxhqg6Nx1PdAZy4= -github.com/wakatime/goInfo v0.1.0-wakatime.8/go.mod h1:aEt7p9Rvh67BYApmZwNDPpgircTO2kgdmDUoF/1QmwA= github.com/wakatime/goInfo v0.1.0-wakatime.9 h1:QkFBcdCcUwFb2CxacFdt4I4aVPcJRY7nXh0sq1gqu3o= github.com/wakatime/goInfo v0.1.0-wakatime.9/go.mod h1:aEt7p9Rvh67BYApmZwNDPpgircTO2kgdmDUoF/1QmwA= github.com/yookoala/realpath v1.0.0 h1:7OA9pj4FZd+oZDsyvXWQvjn5oBdcHRTV44PpdMSuImQ= diff --git a/pkg/heartbeat/language.go b/pkg/heartbeat/language.go index 04487846..48c8051e 100644 --- a/pkg/heartbeat/language.go +++ b/pkg/heartbeat/language.go @@ -345,6 +345,8 @@ const ( LanguageDataWeave // LanguageDASM16 represents the DASM16 programming language. LanguageDASM16 + // LanguageDax represents the Dax programming language. + LanguageDax // LanguageDCL represents the DCL programming language. LanguageDCL // LanguageDCPU16Asm represents the DCPU16Asm programming language. @@ -617,6 +619,8 @@ const ( LanguageHAProxy // LanguageHarbour represents the Harbour programming language. LanguageHarbour + // LanguageHare represents the Hare programming language. + LanguageHare // LanguageHaskell represents the Haskell programming language. LanguageHaskell // LanguageHaxe represents the Haxe programming language. @@ -979,6 +983,8 @@ const ( LanguageNuSMV // LanguageObjdump represents the Objdump programming language. LanguageObjdump + // LanguageObjectPascal represents the ObjectPascal programming language. + LanguageObjectPascal // LanguageObjectiveC represents the ObjectiveC programming language. LanguageObjectiveC // LanguageObjectiveCPP represents the ObjectiveC++ programming language. @@ -1745,6 +1751,7 @@ const ( languageDartStr = "Dart" languageDataWeaveStr = "DataWeave" languageDASM16Str = "DASM16" + languageDaxStr = "Dax" languageDCLStr = "DCL" languageDCPU16AsmStr = "DCPU-16 ASM" languageDebianControlFileStr = "Debian Control file" @@ -1880,6 +1887,7 @@ const ( languageHandlebarsStr = "Handlebars" languageHAProxyStr = "HAProxy" languageHarbourStr = "Harbour" + languageHareStr = "Hare" languageHaskellStr = "Haskell" languageHaxeStr = "Haxe" languageHCLStr = "HCL" @@ -2061,6 +2069,7 @@ const ( languageNushellStr = "Nushell" languageNuSMVStr = "NuSMV" languageObjdumpStr = "objdump" + languageObjectPascalStr = "ObjectPascal" languageObjectiveCStr = "Objective-C" languageObjectiveCPPStr = "Objective-C++" languageObjectiveJStr = "Objective-J" @@ -2755,6 +2764,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageDataWeave, true case normalizeString(languageDASM16Str): return LanguageDASM16, true + case normalizeString(languageDaxStr): + return LanguageDax, true case normalizeString(languageDCLStr): return LanguageDCL, true case normalizeString(languageDCPU16AsmStr): @@ -3025,6 +3036,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageHAProxy, true case normalizeString(languageHarbourStr): return LanguageHarbour, true + case normalizeString(languageHareStr): + return LanguageHare, true case normalizeString(languageHaskellStr): return LanguageHaskell, true case normalizeString(languageHaxeStr): @@ -3387,6 +3400,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageNASMObjdump, true case normalizeString(languageObjdumpStr): return LanguageObjdump, true + case normalizeString(languageObjectPascalStr): + return LanguageObjectPascal, true case normalizeString(languageObjectiveCStr): return LanguageObjectiveC, true case normalizeString(languageObjectiveCPPStr): @@ -4447,6 +4462,8 @@ func (l Language) String() string { return languageDataWeaveStr case LanguageDASM16: return languageDASM16Str + case LanguageDax: + return languageDaxStr case LanguageDCL: return languageDCLStr case LanguageDCPU16Asm: @@ -4713,6 +4730,8 @@ func (l Language) String() string { return languageHAProxyStr case LanguageHarbour: return languageHarbourStr + case LanguageHare: + return languageHareStr case LanguageHaskell: return languageHaskellStr case LanguageHaxe: @@ -5075,6 +5094,8 @@ func (l Language) String() string { return languageNASMObjdumpStr case LanguageObjdump: return languageObjdumpStr + case LanguageObjectPascal: + return languageObjectPascalStr case LanguageObjectiveC: return languageObjectiveCStr case LanguageObjectiveCPP: diff --git a/pkg/heartbeat/language_test.go b/pkg/heartbeat/language_test.go index bba94067..fa670e34 100644 --- a/pkg/heartbeat/language_test.go +++ b/pkg/heartbeat/language_test.go @@ -182,6 +182,7 @@ func languageTests() map[string]heartbeat.Language { "Dart": heartbeat.LanguageDart, "DataWeave": heartbeat.LanguageDataWeave, "DASM16": heartbeat.LanguageDASM16, + "Dax": heartbeat.LanguageDax, "DCL": heartbeat.LanguageDCL, "DCPU-16 ASM": heartbeat.LanguageDCPU16Asm, "Debian Control file": heartbeat.LanguageDebianControlFile, @@ -314,6 +315,7 @@ func languageTests() map[string]heartbeat.Language { "Handlebars": heartbeat.LanguageHandlebars, "HAProxy": heartbeat.LanguageHAProxy, "Harbour": heartbeat.LanguageHarbour, + "Hare": heartbeat.LanguageHare, "Haskell": heartbeat.LanguageHaskell, "Haxe": heartbeat.LanguageHaxe, "HCL": heartbeat.LanguageHCL, @@ -495,6 +497,7 @@ func languageTests() map[string]heartbeat.Language { "NuSMV": heartbeat.LanguageNuSMV, "objdump": heartbeat.LanguageObjdump, "objdump-nasm": heartbeat.LanguageNASMObjdump, + "ObjectPascal": heartbeat.LanguageObjectPascal, "Objective-C": heartbeat.LanguageObjectiveC, "Objective-C++": heartbeat.LanguageObjectiveCPP, "Objective-J": heartbeat.LanguageObjectiveJ, diff --git a/pkg/language/chroma.go b/pkg/language/chroma.go index 088def93..223fec95 100644 --- a/pkg/language/chroma.go +++ b/pkg/language/chroma.go @@ -21,6 +21,7 @@ const maxFileSize = 512000 // detectChromaCustomized returns the best by filename matching lexer. Best lexer is determined // by customized priority. +// If guessLanguage is true, the file content will be used to detect the language. // This is a modified implementation of chroma.lexers.internal.api:Match(). func detectChromaCustomized(filepath string, guessLanguage bool) (heartbeat.Language, float32, bool) { _, file := fp.Split(filepath) diff --git a/pkg/language/language_test.go b/pkg/language/language_test.go index 36466ff3..7fa02f59 100644 --- a/pkg/language/language_test.go +++ b/pkg/language/language_test.go @@ -380,13 +380,6 @@ func TestDetect_ChromaTopLanguagesRetrofit(t *testing.T) { Filepaths: []string{"path/to/file.dart"}, Expected: heartbeat.LanguageDart, }, - "delphi": { - Filepaths: []string{ - "path/to/file.pas", - "path/to/file.dpr", - }, - Expected: heartbeat.LanguageDelphi, - }, "docker": { Filepaths: []string{ "path/to/Dockerfile", @@ -579,6 +572,13 @@ func TestDetect_ChromaTopLanguagesRetrofit(t *testing.T) { Filepaths: []string{"path/to/file.nix"}, Expected: heartbeat.LanguageNix, }, + "object pascal": { + Filepaths: []string{ + "path/to/file.pas", + "path/to/file.dpr", + }, + Expected: heartbeat.LanguageObjectPascal, + }, "objective j": { Filepaths: []string{"path/to/file.j"}, Expected: heartbeat.LanguageObjectiveJ, diff --git a/pkg/lexer/delphi.go b/pkg/lexer/delphi.go index 60f2b72f..5d4998ca 100644 --- a/pkg/lexer/delphi.go +++ b/pkg/lexer/delphi.go @@ -14,8 +14,8 @@ func (l Delphi) Lexer() chroma.Lexer { return chroma.MustNewLexer( &chroma.Config{ Name: l.Name(), - Aliases: []string{"delphi", "pas", "pascal", "objectpascal"}, - Filenames: []string{"*.pas", "*.dpr", "*.fmx", "*.dfm"}, + Aliases: []string{"delphi"}, + Filenames: []string{"*.fmx", "*.dfm"}, MimeTypes: []string{"text/x-pascal"}, }, func() chroma.Rules { From 7e465897d4d2c6c7ba680c388db08301f037174b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Henrique=20Guard=C3=A3o=20Gandarez?= Date: Tue, 17 Sep 2024 11:10:30 -0300 Subject: [PATCH 2/3] Bump Chroma to v2.13.0 --- go.mod | 6 ++-- go.sum | 16 +++++------ pkg/heartbeat/language.go | 52 ++++++++++++++++++++++++++++------ pkg/heartbeat/language_test.go | 10 ++++++- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 03b93a1d..842da926 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ go 1.22.5 require ( github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 github.com/alecthomas/assert v1.0.0 - github.com/alecthomas/chroma/v2 v2.12.0 + github.com/alecthomas/chroma/v2 v2.13.0 github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 - github.com/dlclark/regexp2 v1.10.0 + github.com/dlclark/regexp2 v1.11.0 github.com/gandarez/go-olson-timezone v0.1.0 github.com/gandarez/go-realpath v1.0.0 github.com/juju/mutex v0.0.0-20180619145857-d21b13acf4bf @@ -30,7 +30,7 @@ require ( require ( github.com/alecthomas/colour v0.1.0 // indirect - github.com/alecthomas/repr v0.3.0 // indirect + github.com/alecthomas/repr v0.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect diff --git a/go.sum b/go.sum index ae3cd63e..867bdc83 100644 --- a/go.sum +++ b/go.sum @@ -42,14 +42,14 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/alecthomas/assert v1.0.0 h1:3XmGh/PSuLzDbK3W2gUbRXwgW5lqPkuqvRgeQ30FI5o= github.com/alecthomas/assert v1.0.0/go.mod h1:va/d2JC+M7F6s+80kl/R3G7FUiW6JzUO+hPhLyJ36ZY= -github.com/alecthomas/assert/v2 v2.2.1 h1:XivOgYcduV98QCahG8T5XTezV5bylXe+lBxLG2K2ink= -github.com/alecthomas/assert/v2 v2.2.1/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/chroma/v2 v2.12.0 h1:Wh8qLEgMMsN7mgyG8/qIpegky2Hvzr4By6gEF7cmWgw= -github.com/alecthomas/chroma/v2 v2.12.0/go.mod h1:4TQu7gdfuPjSh76j78ietmqh9LiurGF0EpseFXdKMBw= +github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= +github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+ooU1lI= +github.com/alecthomas/chroma/v2 v2.13.0/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk= github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk= github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= -github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= -github.com/alecthomas/repr v0.3.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -65,8 +65,8 @@ github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= -github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= diff --git a/pkg/heartbeat/language.go b/pkg/heartbeat/language.go index 48c8051e..8d1dab6a 100644 --- a/pkg/heartbeat/language.go +++ b/pkg/heartbeat/language.go @@ -355,8 +355,8 @@ const ( LanguageDebianControlFile // LanguageDelphi represents the Delphi programming language. LanguageDelphi - // LanguageDesktop represents the desktop programming language. - LanguageDesktop + // LanguageDesktopFile represents the Desktop file programming language. + LanguageDesktopFile // LanguageDevicetree represents the Devicetree programming language. LanguageDevicetree // LanguageDG represents the DG programming language. @@ -867,6 +867,8 @@ const ( LanguageMask // LanguageMason represents the Mason programming language. LanguageMason + // LanguageMaterializeSQLDialect represents the Materialize SQL dialect programming language. + LanguageMaterializeSQLDialect // LanguageMathematica represents the Mathematica programming language. LanguageMathematica // LanguageMatlab represents the Matlab programming language. @@ -949,6 +951,8 @@ const ( LanguageNatural // LanguageNCL represents the NCL programming language. LanguageNCL + // LanguageNDISASM represents the NDISASM programming language. + LanguageNDISASM // LanguageNemerle represents the Nemerle programming language. LanguageNemerle // LanguageNeon represents the Neon programming language. @@ -1065,6 +1069,8 @@ const ( LanguageProcessing // LanguageProlog represents the Prolog programming language. LanguageProlog + // LanguagePromela represents the Promela programming language. + LanguagePromela // LanguagePromQL represents the PromQL programming language. LanguagePromQL // LanguageProtocolBuffer represents the ProtocolBuffer programming language. @@ -1139,14 +1145,16 @@ const ( LanguageRed // LanguageRedcode represents the Redcode programming language. LanguageRedcode + // LanguageRegistry represents the Registry programming language. + LanguageRegistry + // LanguageRego represents the Rego programming language. + LanguageRego // LanguageRegularExpression represents the RegularExpression programming language. LanguageRegularExpression // LanguageRenderScript represents the RenderScript programming language. LanguageRenderScript // LanguageRenPy represents the RenPy programming language. LanguageRenPy - // LanguageRegistry represents the Registry programming language. - LanguageRegistry // LanguageReScript represents the ReScript programming language. LanguageReScript // LanguageResourceBundle represents the ResourceBundle programming language. @@ -1757,6 +1765,8 @@ const ( languageDebianControlFileStr = "Debian Control file" languageDelphiStr = "Delphi" languageDesktopStr = "desktop" + languageDesktopEntryStr = "desktop_entry" + languageDesktopFileStr = "Desktop file" languageDevicetreeStr = "Devicetree" languageDGStr = "dg" languageDhallStr = "Dhall" @@ -2011,6 +2021,8 @@ const ( languageMarkoStr = "Marko" languageMaskStr = "Mask" languageMasonStr = "Mason" + languageMaterializeStr = "materialize" + languageMaterializeSQLDialectStr = "Materialize SQL dialect" languageMathematicaStr = "Mathematica" languageMatlabStr = "Matlab" languageMatlabSessionStr = "Matlab session" @@ -2048,10 +2060,12 @@ const ( languageMXMLStr = "MXML" languageMyghtyStr = "Myghty" languageMySQLStr = "MySQL" + languageMzqlStr = "mzql" languageNASMStr = "NASM" languageNASMObjdumpStr = "objdump-nasm" languageNaturalStr = "Natural" languageNCLStr = "NCL" + languageNDISASMStr = "NDISASM" languageNemerleStr = "Nemerle" languageNeonStr = "Neon" languageNesCStr = "nesC" @@ -2110,6 +2124,7 @@ const ( languagePraatStr = "Praat" languageProcessingStr = "Processing" languagePrologStr = "Prolog" + languagePromelaStr = "Promela" languagePromQLStr = "PromQL" languageProtocolBufferStr = "Protocol Buffer" languagePRQLStr = "PRQL" @@ -2148,6 +2163,7 @@ const ( languageRedStr = "Red" languageRedcodeStr = "Redcode" languageRegistryStr = "reg" + languageRegoStr = "Rego" languageRegularExpressionStr = "Regular Expression" languageRenderScriptStr = "RenderScript" languageRenPyStr = "Ren'Py" @@ -2774,8 +2790,10 @@ func ParseLanguage(s string) (Language, bool) { return LanguageDebianControlFile, true case normalizeString(languageDelphiStr): return LanguageDelphi, true - case normalizeString(languageDesktopStr): - return LanguageDesktop, true + case normalizeString(languageDesktopStr), + normalizeString(languageDesktopEntryStr), + normalizeString(languageDesktopFileStr): + return LanguageDesktopFile, true case normalizeString(languageDevicetreeStr): return LanguageDevicetree, true case normalizeString(languageDGStr): @@ -3284,6 +3302,10 @@ func ParseLanguage(s string) (Language, bool) { return LanguageMask, true case normalizeString(languageMasonStr): return LanguageMason, true + case normalizeString(languageMaterializeStr), + normalizeString(languageMaterializeSQLDialectStr), + normalizeString(languageMzqlStr): + return LanguageMaterializeSQLDialect, true case normalizeString(languageMathematicaStr): return LanguageMathematica, true case normalizeString(languageMatlabStr): @@ -3364,6 +3386,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageNatural, true case normalizeString(languageNCLStr): return LanguageNCL, true + case normalizeString(languageNDISASMStr): + return LanguageNDISASM, true case normalizeString(languageNemerleStr): return LanguageNemerle, true case normalizeString(languageNeonStr): @@ -3482,6 +3506,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageProcessing, true case normalizeString(languagePrologStr): return LanguageProlog, true + case normalizeString(languagePromelaStr): + return LanguagePromela, true case normalizeString(languagePromQLStr): return LanguagePromQL, true case normalizeString(languageProtocolBufferStr): @@ -3558,6 +3584,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageRedcode, true case normalizeString(languageRegistryStr): return LanguageRegistry, true + case normalizeString(languageRegoStr): + return LanguageRego, true case normalizeString(languageRegularExpressionStr): return LanguageRegularExpression, true case normalizeString(languageRenderScriptStr): @@ -4472,8 +4500,8 @@ func (l Language) String() string { return languageDebianControlFileStr case LanguageDelphi: return languageDelphiStr - case LanguageDesktop: - return languageDesktopStr + case LanguageDesktopFile: + return languageDesktopFileStr case LanguageDevicetree: return languageDevicetreeStr case LanguageDG: @@ -4978,6 +5006,8 @@ func (l Language) String() string { return languageMaskStr case LanguageMason: return languageMasonStr + case LanguageMaterializeSQLDialect: + return languageMaterializeSQLDialectStr case LanguageMathematica: return languageMathematicaStr case LanguageMatlab: @@ -5058,6 +5088,8 @@ func (l Language) String() string { return languageNaturalStr case LanguageNCL: return languageNCLStr + case LanguageNDISASM: + return languageNDISASMStr case LanguageNemerle: return languageNemerleStr case LanguageNeon: @@ -5178,6 +5210,8 @@ func (l Language) String() string { return languageProcessingStr case LanguageProlog: return languagePrologStr + case LanguagePromela: + return languagePromelaStr case LanguagePromQL: return languagePromQLStr case LanguageProtocolBuffer: @@ -5252,6 +5286,8 @@ func (l Language) String() string { return languageRedcodeStr case LanguageRegistry: return languageRegistryStr + case LanguageRego: + return languageRegoStr case LanguageRegularExpression: return languageRegularExpressionStr case LanguageRenderScript: diff --git a/pkg/heartbeat/language_test.go b/pkg/heartbeat/language_test.go index fa670e34..d606c724 100644 --- a/pkg/heartbeat/language_test.go +++ b/pkg/heartbeat/language_test.go @@ -188,7 +188,7 @@ func languageTests() map[string]heartbeat.Language { "Debian Control file": heartbeat.LanguageDebianControlFile, "Debian Sourcelist": heartbeat.LanguageSourcesList, "Delphi": heartbeat.LanguageDelphi, - "desktop": heartbeat.LanguageDesktop, + "Desktop file": heartbeat.LanguageDesktopFile, "Devicetree": heartbeat.LanguageDevicetree, "dg": heartbeat.LanguageDG, "Dhall": heartbeat.LanguageDhall, @@ -439,6 +439,7 @@ func languageTests() map[string]heartbeat.Language { "Marko": heartbeat.LanguageMarko, "Mask": heartbeat.LanguageMask, "Mason": heartbeat.LanguageMason, + "Materialize SQL dialect": heartbeat.LanguageMaterializeSQLDialect, "Mathematica": heartbeat.LanguageMathematica, "Matlab": heartbeat.LanguageMatlab, "Matlab session": heartbeat.LanguageMatlabSession, @@ -479,6 +480,7 @@ func languageTests() map[string]heartbeat.Language { "NASM": heartbeat.LanguageNASM, "Natural": heartbeat.LanguageNatural, "NCL": heartbeat.LanguageNCL, + "NDISASM": heartbeat.LanguageNDISASM, "Nemerle": heartbeat.LanguageNemerle, "Neon": heartbeat.LanguageNeon, "nesC": heartbeat.LanguageNesC, @@ -538,6 +540,7 @@ func languageTests() map[string]heartbeat.Language { "Praat": heartbeat.LanguagePraat, "Processing": heartbeat.LanguageProcessing, "Prolog": heartbeat.LanguageProlog, + "Promela": heartbeat.LanguagePromela, "PromQL": heartbeat.LanguagePromQL, "Property Specification Language": heartbeat.LanguagePSL, "Protocol Buffer": heartbeat.LanguageProtocolBuffer, @@ -575,6 +578,7 @@ func languageTests() map[string]heartbeat.Language { "Red": heartbeat.LanguageRed, "Redcode": heartbeat.LanguageRedcode, "reg": heartbeat.LanguageRegistry, + "Rego": heartbeat.LanguageRego, "Regular Expression": heartbeat.LanguageRegularExpression, "RenderScript": heartbeat.LanguageRenderScript, "Ren'Py": heartbeat.LanguageRenPy, @@ -796,9 +800,13 @@ func languageTestsAliases() map[string]heartbeat.Language { "ASP Classic": heartbeat.LanguageClassicASP, "Batch Script": heartbeat.LanguageBatchfile, "csharp": heartbeat.LanguageCSharp, + "desktop": heartbeat.LanguageDesktopFile, + "desktop_entry": heartbeat.LanguageDesktopFile, "FStar": heartbeat.LanguageFStar, "Golang": heartbeat.LanguageGo, "JSON-LD": heartbeat.LanguageJSONLD, + "materialize": heartbeat.LanguageMaterializeSQLDialect, + "mzql": heartbeat.LanguageMaterializeSQLDialect, "SaltStack": heartbeat.LanguageSalt, "Transact-SQL": heartbeat.LanguageTransactSQL, "Visual Basic .NET": heartbeat.LanguageVBNet, From 11a979076ad7f2f04f66ceb44687f5ed3bbf30e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Henrique=20Guard=C3=A3o=20Gandarez?= Date: Tue, 17 Sep 2024 11:21:05 -0300 Subject: [PATCH 3/3] Bump Chroma to v2.14.0 --- go.mod | 2 +- go.sum | 8 ++++---- pkg/heartbeat/language.go | 7 +++++++ pkg/heartbeat/language_test.go | 1 + 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 842da926..1655f0d1 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.5 require ( github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 github.com/alecthomas/assert v1.0.0 - github.com/alecthomas/chroma/v2 v2.13.0 + github.com/alecthomas/chroma/v2 v2.14.0 github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 github.com/dlclark/regexp2 v1.11.0 github.com/gandarez/go-olson-timezone v0.1.0 diff --git a/go.sum b/go.sum index 867bdc83..e1b26ea2 100644 --- a/go.sum +++ b/go.sum @@ -42,10 +42,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/alecthomas/assert v1.0.0 h1:3XmGh/PSuLzDbK3W2gUbRXwgW5lqPkuqvRgeQ30FI5o= github.com/alecthomas/assert v1.0.0/go.mod h1:va/d2JC+M7F6s+80kl/R3G7FUiW6JzUO+hPhLyJ36ZY= -github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= -github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= -github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+ooU1lI= -github.com/alecthomas/chroma/v2 v2.13.0/go.mod h1:BUGjjsD+ndS6eX37YgTchSEG+Jg9Jv1GiZs9sqPqztk= +github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE= +github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= +github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk= github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= diff --git a/pkg/heartbeat/language.go b/pkg/heartbeat/language.go index 8d1dab6a..18913952 100644 --- a/pkg/heartbeat/language.go +++ b/pkg/heartbeat/language.go @@ -563,6 +563,8 @@ const ( LanguageGitAttributes // LanguageGitConfig represents the Git Config programming language. LanguageGitConfig + // LanguageGleam represents the Gleam programming language. + LanguageGleam // LanguageGLSL represents the GLSL programming language. LanguageGLSL // LanguageGlyph represents the Glyph programming language. @@ -1871,6 +1873,7 @@ const ( languageGitStr = "Git" languageGitAttributesStr = "Git Attributes" languageGitConfigStr = "Git Config" + languageGleamStr = "Gleam" languageGLSLStr = "GLSL" languageGlyphStr = "Glyph" languageGlyphBitmapStr = "Glyph Bitmap Distribution Format" @@ -3002,6 +3005,8 @@ func ParseLanguage(s string) (Language, bool) { return LanguageGitAttributes, true case normalizeString(languageGitConfigStr): return LanguageGitConfig, true + case normalizeString(languageGleamStr): + return LanguageGleam, true case normalizeString(languageGLSLStr): return LanguageGLSL, true case normalizeString(languageGlyphStr): @@ -4708,6 +4713,8 @@ func (l Language) String() string { return languageGitAttributesStr case LanguageGitConfig: return languageGitConfigStr + case LanguageGleam: + return languageGleamStr case LanguageGLSL: return languageGLSLStr case LanguageGlyph: diff --git a/pkg/heartbeat/language_test.go b/pkg/heartbeat/language_test.go index d606c724..8fc68dfb 100644 --- a/pkg/heartbeat/language_test.go +++ b/pkg/heartbeat/language_test.go @@ -290,6 +290,7 @@ func languageTests() map[string]heartbeat.Language { "Git": heartbeat.LanguageGit, "Git Attributes": heartbeat.LanguageGitAttributes, "Git Config": heartbeat.LanguageGitConfig, + "Gleam": heartbeat.LanguageGleam, "GLSL": heartbeat.LanguageGLSL, "Glyph": heartbeat.LanguageGlyph, "Glyph Bitmap Distribution Format": heartbeat.LanguageGlyphBitmap,