u/InevitableHour908

▲ 1 r/neovim

Defining regex to be completely ignored by treesitter?

I'm working on html/css/js with some non-standard elements and it's causing issues with the treesitter.

I'm making a tumblr theme, so things like {color:Background} will get replaced with a user-defined color, or {block:HomePage}.*{/block:HomePage} is code that will only be processed on the user's home page. The treesitter can't handle these, so everything after the first instance of tumblr-specific code is unhighlighted and :InspectTree is full of errors.

Is there any way to define regex to be ignored by the treesitter for specific languages? All normal instances of braces in css and js on a single line are padded with spaces, like "{ color: #fff }", so could I have the treesitter ignore {\S[^}]*} somehow? Like treat it as if it isn't there?

Tumblr's own code editor properly handles these but I would really rather use neovim.

reddit.com
u/InevitableHour908 — 25 days ago