@@ -384,12 +384,19 @@ with the markdown_inline grammar."
384
384
marker: _ @clojure-ts-keyword-face
385
385
delimiter: _ :? @default))
386
386
387
+ ; ; Highlight as built-in only if there is no namespace or namespace is
388
+ ; ; `clojure.core' .
387
389
:feature 'builtin
388
390
:language 'clojure
389
- `(((list_lit meta: _ :? :anchor (sym_lit (sym_name) @font-lock-keyword-face))
390
- (:match , clojure-ts--builtin-symbol-regexp @font-lock-keyword-face))
391
- ((sym_name) @font-lock-builtin-face
392
- (:match , clojure-ts--builtin-dynamic-var-regexp @font-lock-builtin-face)))
391
+ `(((list_lit meta: _ :? :anchor (sym_lit !namespace name: (sym_name) @font-lock-keyword-face))
392
+ (:match , clojure-ts--builtin-symbol-regexp @font-lock-keyword-face))
393
+ ((list_lit meta: _ :? :anchor
394
+ (sym_lit namespace: ((sym_ns) @ns
395
+ (:equal " clojure.core" @ns))
396
+ name: (sym_name) @font-lock-keyword-face))
397
+ (:match , clojure-ts--builtin-symbol-regexp @font-lock-keyword-face))
398
+ ((sym_name) @font-lock-builtin-face
399
+ (:match , clojure-ts--builtin-dynamic-var-regexp @font-lock-builtin-face)))
393
400
394
401
; ; Any function calls, not built-ins.
395
402
; ; This can give false positives (macros, quoted lists, namespace imports)
@@ -408,12 +415,13 @@ with the markdown_inline grammar."
408
415
; ; No wonder the tree-sitter-clojure grammar only touches syntax, and not semantics
409
416
:feature 'definition ; ; defn and defn like macros
410
417
:language 'clojure
411
- `(((list_lit :anchor meta: _ :?
412
- :anchor (sym_lit (sym_name) @def )
418
+ `(((list_lit :anchor meta: _ :*
419
+ :anchor (sym_lit (sym_name) @font-lock-keyword-face )
413
420
:anchor (sym_lit (sym_name) @font-lock-function-name-face))
414
421
(:match ,(rx-to-string
415
422
`(seq bol
416
423
(or
424
+ " fn"
417
425
" defn"
418
426
" defn-"
419
427
" defmulti"
@@ -423,7 +431,7 @@ with the markdown_inline grammar."
423
431
" defmacro"
424
432
" definline" )
425
433
eol))
426
- @def ))
434
+ @font-lock-keyword-face ))
427
435
((anon_fn_lit
428
436
marker: " #" @font-lock-property-face))
429
437
; ; Methods implementation
@@ -450,10 +458,10 @@ with the markdown_inline grammar."
450
458
451
459
:feature 'variable ; ; def, defonce
452
460
:language 'clojure
453
- `(((list_lit :anchor meta: _ :?
454
- :anchor (sym_lit (sym_name) @def )
461
+ `(((list_lit :anchor meta: _ :*
462
+ :anchor (sym_lit (sym_name) @font-lock-keyword-face )
455
463
:anchor (sym_lit (sym_name) @font-lock-variable-name-face))
456
- (:match , clojure-ts--variable-definition-symbol-regexp @def )))
464
+ (:match , clojure-ts--variable-definition-symbol-regexp @font-lock-keyword-face )))
457
465
458
466
; ; Can we support declarations in the namespace form?
459
467
:feature 'type
@@ -479,10 +487,10 @@ with the markdown_inline grammar."
479
487
:override t
480
488
`((meta_lit
481
489
marker: " ^" @font-lock-operator-face
482
- value: (kwd_lit (kwd_name) @font-lock-property-name -face))
490
+ value: (kwd_lit (kwd_name) @clojure-ts-keyword -face))
483
491
(old_meta_lit
484
492
marker: " #^" @font-lock-operator-face
485
- value: (kwd_lit (kwd_name) @font-lock-property-name -face)))
493
+ value: (kwd_lit (kwd_name) @clojure-ts-keyword -face)))
486
494
487
495
:feature 'tagged-literals
488
496
:language 'clojure
0 commit comments