Substitution reference is not highlighted
kiryph opened this issue · comments
Consider this part of a Makefile:
sources := $(objects:.o=.c)
sources := $(patsubst %.o,%.c,$(objects))
(from https://www.gnu.org/software/make/manual/html_node/Text-Functions.html)
and this screenshot of neovim with treesitter syntax highlighting:
:TSPlaygroundToggle
reveals following syntax tree:
variable_assignment [0, 0] - [1, 0]
name: word [0, 0] - [0, 7]
value: text [0, 11] - [0, 27]
substitution_reference [0, 11] - [0, 27]
text: word [0, 13] - [0, 20]
pattern: word [0, 21] - [0, 23]
replacement: word [0, 24] - [0, 26]
variable_assignment [1, 0] - [2, 0]
name: word [1, 0] - [1, 7]
value: text [1, 11] - [1, 41]
function_call [1, 11] - [1, 41]
arguments [1, 22] - [1, 40]
argument: text [1, 22] - [1, 40]
variable_reference [1, 30] - [1, 40]
word [1, 32] - [1, 39]
I would expect that the dollar sign with the parentheses are highlighted in the first line.
Sorry, this was a mix up on my side. I had installed nvim-treesitter with its own highlights.scm
which is responsible for not highlighting dollar and its parentheses of substitution references.
If one has installed nvim-treesitter
with its own highlights.scm
but want to use highlights.scm
of this repository, you can install it in ~/.config/nvim/queries/make/highlights.scm
which has higher priority as, e.g. the Packer.nvim path:
wget -P ~/.config/nvim/queries/make/ https://raw.githubusercontent.com/alemuller/tree-sitter-make/main/queries/highlights.scm