Skip to content

Commit

Permalink
Use languages from heartbeat package
Browse files Browse the repository at this point in the history
  • Loading branch information
gandarez committed Aug 29, 2023
1 parent d7422d6 commit 2232c8b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pkg/lexer/c_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/alecthomas/chroma/v2/lexers"
"github.com/wakatime/wakatime-cli/pkg/heartbeat"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -29,7 +30,7 @@ func TestC_AnalyseText(t *testing.T) {
},
}

l := lexers.Get("C")
l := lexers.Get(heartbeat.LanguageC.StringChroma())
require.NotNil(t, l)

for name, test := range tests {
Expand Down
3 changes: 2 additions & 1 deletion pkg/lexer/cpp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/alecthomas/chroma/v2/lexers"
"github.com/wakatime/wakatime-cli/pkg/heartbeat"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -25,7 +26,7 @@ func TestCpp_AnalyseText(t *testing.T) {
},
}

l := lexers.Get("C++")
l := lexers.Get(heartbeat.LanguageCPP.StringChroma())
require.NotNil(t, l)

for name, test := range tests {
Expand Down
2 changes: 1 addition & 1 deletion pkg/lexer/cuda.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (l CUDA) Lexer() chroma.Lexer {
)

lexer.SetAnalyser(func(text string) float32 {
c := lexers.Get("C")
c := lexers.Get(heartbeat.LanguageC.StringChroma())
if c == nil {
return 0
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/lexer/ec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (l EC) Lexer() chroma.Lexer {
)

lexer.SetAnalyser(func(text string) float32 {
c := lexers.Get("C")
c := lexers.Get(heartbeat.LanguageC.StringChroma())
if c == nil {
return 0
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/lexer/nesc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (l NesC) Lexer() chroma.Lexer {
)

lexer.SetAnalyser(func(text string) float32 {
c := lexers.Get("C")
c := lexers.Get(heartbeat.LanguageC.StringChroma())
if c == nil {
return 0
}
Expand Down

0 comments on commit 2232c8b

Please sign in to comment.