Add font-locking for variables in go-ts-mode range clauses (bug#71209)
* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings): Add font-locking rule for variable names in range clauses. * test/lisp/progmodes/go-ts-mode-tests.el (go-ts-test-font-lock): Add font-locking test for go-ts-mode. * test/lisp/progmodes/go-ts-mode-resources/font-lock.go: New file for go-ts-mode font-locking tests.
This commit is contained in:
parent
d2dce51344
commit
3021421892
3 changed files with 14 additions and 1 deletions
|
@ -180,7 +180,10 @@
|
|||
(identifier) @font-lock-variable-name-face
|
||||
("," (identifier) @font-lock-variable-name-face)*))
|
||||
(var_spec name: (identifier) @font-lock-variable-name-face
|
||||
("," name: (identifier) @font-lock-variable-name-face)*))
|
||||
("," name: (identifier) @font-lock-variable-name-face)*)
|
||||
(range_clause
|
||||
left: (expression_list
|
||||
(identifier) @font-lock-variable-name-face)))
|
||||
|
||||
:language 'go
|
||||
:feature 'function
|
||||
|
|
5
test/lisp/progmodes/go-ts-mode-resources/font-lock.go
Normal file
5
test/lisp/progmodes/go-ts-mode-resources/font-lock.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
for idx, val := range arr {}
|
||||
// ^ font-lock-variable-name-face
|
||||
// ^ font-lock-variable-name-face
|
||||
for idx := 0; idx < n; idx++ {}
|
||||
// ^ font-lock-variable-name-face
|
|
@ -27,5 +27,10 @@
|
|||
(skip-unless (treesit-ready-p 'go))
|
||||
(ert-test-erts-file (ert-resource-file "indent.erts")))
|
||||
|
||||
(ert-deftest go-ts-test-font-lock ()
|
||||
(skip-unless (treesit-ready-p 'go))
|
||||
(let ((treesit-font-lock-level 4))
|
||||
(ert-font-lock-test-file (ert-resource-file "font-lock.go") 'go-ts-mode)))
|
||||
|
||||
(provide 'go-ts-mode-tests)
|
||||
;;; go-ts-mode-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue