latex-lsp / tree-sitter-latex

LaTeX grammar for tree-sitter
MIT License
98 stars 24 forks source link

Ending math node with _ breaks math environment #104

Closed Roger-Roger-debug closed 6 months ago

Roger-Roger-debug commented 7 months ago

I'm using autosnippets are restricted to math mode. This works fine for the most part, except that if I'm writing some math like \(a_{b}\) the syntax tree is broken at \(a_\). When I end the math environment on a _, it is no longer recognized as such at my snippets break. The same happens for ^, which is quite unfortunate as I have __ and ^^ as snippets that should expand to _{} and ^{}, but only in math environments.

This doesn't happen if I put a character behind _, like \(a_ b\). Then the math environment isn't broken and my snippet expands just fine.

Roger-Roger-debug commented 6 months ago

I've changed nothing and it's working again.

Roger-Roger-debug commented 6 months ago

Forgot to close