Multi-line Comment Parsing #1173
Replies: 3 comments 3 replies
-
you can make the closing delimiter |
Beta Was this translation helpful? Give feedback.
-
So, this works, but it's hacky and not a true "match anything" resolution, which I'll keep looking for. I tried |
Beta Was this translation helpful? Give feedback.
-
A bit of more info for everyone who will see this question: |
Beta Was this translation helpful? Give feedback.
-
I found yet another oddity that my nearly non-existent regex skills have yet to be able to overcome. Since I'm using tree-sitter's CST as a source for syntax highlighting, it has to work as you type, which it does for the most part. I've found an issue with multi-line comments, however. Here's the entry that identifies multi-line coments from
grammar.js
:This correctly identifies fully enclosed multi-line comments. However, if the user is typing and enters the multi-line comment opener
/*
, the text does not parse as a comment until the user types in the multi-line comment closer*/
. Is there a way to identify all characters to the end of the file (assuming*/
doesn't exist in the file) as a comment until the user types in the closer? I've done a bit of research, but it seems that js doesn't accept the primary methods for doing this, including\z
. I found two ways that worked in regex sandboxes, but neither worked in the grammar.Beta Was this translation helpful? Give feedback.
All reactions