-
-
Notifications
You must be signed in to change notification settings - Fork 439
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
<lexer>
<config>
...
<case_insensitive>true</case_insensitive>
<analyse>
<regex pattern="ctl-opt" score="0.9"/>
</analyse>
</config>
</lexer>
Unless I made a mistake, with this lexer configuration, I declared the language as case-insensitive. However Analyse() seems to ignore the case-insensitivity.
To Reproduce
package main
import (
"github.com/alecthomas/chroma/v2/lexers"
)
var s string = "Ctl-opt" // note the uppercase C
func main() {
lexer := lexers.Analyse(s)
if lexer == nil {
println("nil !")
} else {
println(lexer.Config().Name)
}
}
It should print the name of my lexer, but it actually prints "nil !", meaning the analysis failed. I added some debug log in Analyse() to display the weight of each lexer, and mine has indeed 0 instead of 0.9.