altermo / ultimate-autopair.nvim

A treesitter supported autopairing plugin with extensions, and much more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How to ignore a specific parser?

alexmozaidze opened this issue · comments

Question

How do I specify to ultimate-autopair which parsers it should ignore?

I want to make ultimate-autopair ignore tree-sitter-comment since it's an "embedded parser" of some sort, which messes with my custom queries when making tree-sitter-comment work in HTML. (See tree-sitter/tree-sitter-html #73)

Problem

If in HTML I do the following (where | is the cursor):

<!--|

It works as expected:

<!--|-->

But pressing <space> doesn't work as expected, since it's now inside the comment parser:

<!-- |-->

This is an issue to be fixed in the HTML parser, but it would be nice to have a temporary solution to ignore the comment parser, avoiding the problem entirely.

Currently not possible, as the way the current implementation works is by using get_node, and there are no easy ways to make get_node ignore some injected parser.
In the next release, I plan to change it so that instead of using get_node, it will use treesitter-queries to get nodes and injected-langs, which will make this feature possible.