fix: highlight keywords when keyword is actual identifier (#9019)
This PR fixes a bug where semantic highlighting would only highlight keywords that started with an alphanumeric character. Now, it uses `Lean.isIdFirst`.
This commit is contained in:
parent
1a6eae16ec
commit
1edb7632b5
1 changed files with 2 additions and 2 deletions
|
|
@ -110,8 +110,8 @@ partial def collectSyntaxBasedSemanticTokens : (stx : Syntax) → Array LeanSema
|
|||
stx.getArgs.map collectSyntaxBasedSemanticTokens |>.flatten
|
||||
let Syntax.atom _ val := stx
|
||||
| return tokens
|
||||
let isRegularKeyword := val.length > 0 && val.front.isAlpha
|
||||
let isHashKeyword := val.length > 1 && val.front == '#' && (val.get ⟨1⟩).isAlpha
|
||||
let isRegularKeyword := val.length > 0 && isIdFirst val.front
|
||||
let isHashKeyword := val.length > 1 && val.front == '#' && isIdFirst (val.get ⟨1⟩)
|
||||
if ! isRegularKeyword && ! isHashKeyword then
|
||||
return tokens
|
||||
return tokens.push ⟨stx, keywordSemanticTokenMap.findD val .keyword⟩
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue