Unnamed repository; edit this file 'description' to name the repository.
fix(queries:ecma): proper numeric values (#15642)
Ricardo Fernández Serrata 2 months ago
parent 3f033de · commit 27898f3
-rw-r--r--runtime/queries/ecma/highlights.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/queries/ecma/highlights.scm b/runtime/queries/ecma/highlights.scm
index 6013821f..3a09b282 100644
--- a/runtime/queries/ecma/highlights.scm
+++ b/runtime/queries/ecma/highlights.scm
@@ -241,7 +241,15 @@
(escape_sequence) @constant.character.escape
(regex) @string.regexp
-(number) @constant.numeric.integer
+
+; future-proof fall-back, and `TypedArray` values (looks like float, but is int)
+(number) @constant.numeric
+; https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#prod-NumericLiteral
+((number) @constant.numeric.float
+ (#match? @constant.numeric.float "[^n]$"))
+((number) @constant.numeric.integer
+ (#match? @constant.numeric.integer "^[^.][^.\-]*n$"))
+
; Special identifiers
;--------------------