Closed haoming-li-ling closed 5 months ago
It is not possible to tell the injected grammar (in this case the latex grammar) what node the root node should be. The workaround used instead is that we also include the dollars in the injected range. This way the latex grammar will automatically parse everything as it should be.
For me this also seems to be working fine. Which editor are you using? Maybe the injection queries are implemented differently?
Yes, the highlighting works actually fine. But the problem is that some snippets plugins for latex math depend on these nodes. So it would be really useful to name these nodes with inline_formale and displayef_equation.
Actually this is a bug of nvim-treesitter
, and it should be solved in nvim-treesitter
.
https://github.com/nvim-treesitter/nvim-treesitter/pull/5857
After the https://github.com/nvim-treesitter/nvim-treesitter/pull/5857 has been merged, these node can be parsed normally, which solve this issue.
Describe the bug
$ $
and$$ $$
and$$$ $$$
are not just for switching to latex, but specifically, switching to latex math environments. For this is especially important for latex snippets that are math-environment-sensitive to work.Code example
Expected behavior Switch to
inline_formula
anddisplayed_math
for$ $
and$$ $$
,$$$ $$$
respectively.Actual behavior The node is simply
inline
, with latex injection defaulting to text mode.