You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read all the tree-sitter docs if it relates to using the parser
Is your feature request related to a problem? Please describe.
I'm trying to inject other parsers onto C/C++ comments where multi-line context is crucial for correct highlight, namely rst.
Yet I (1) found no way of creating a capture that takes only the relevant parts of the comment and I suspect it is not possible to do so (not sure though) and (2) it's way harder and prone to difficulties than for (e.g.) Python where one has '(expression_statement (string ...))`.
A common injection for C comments is doxygen which is already meant to parse C/C++ comments, but not rst. Closest I got was something like:
Which kind of works, but will fail for comments like this, as an example:
/** * Some title <- seen as a bullet point due to the leading `*` being part of the capture * ========== */
Describe the solution you'd like
A capture that sensibly excludes comment leads, ends and prefixes, and yields the 'payload' only. I'm assuming this is possible of course, which maybe it isn't and maybe I actually need a new rst parser just for this.
Describe alternatives you've considered
Somehow recreating this with a lot of regexes, but I have yet to figure out how and, again, I'm not sure this is even possible one way or another without a specific parser from my little knowledge of how tree sitter works.
Did you check the tree-sitter docs?
Is your feature request related to a problem? Please describe.
I'm trying to inject other parsers onto C/C++ comments where multi-line context is crucial for correct highlight, namely rst.
Yet I (1) found no way of creating a capture that takes only the relevant parts of the comment and I suspect it is not possible to do so (not sure though) and (2) it's way harder and prone to difficulties than for (e.g.) Python where one has '(expression_statement (string ...))`.
A common injection for C comments is doxygen which is already meant to parse C/C++ comments, but not rst. Closest I got was something like:
Which kind of works, but will fail for comments like this, as an example:
Describe the solution you'd like
A capture that sensibly excludes comment leads, ends and prefixes, and yields the 'payload' only. I'm assuming this is possible of course, which maybe it isn't and maybe I actually need a new rst parser just for this.
Describe alternatives you've considered
Somehow recreating this with a lot of regexes, but I have yet to figure out how and, again, I'm not sure this is even possible one way or another without a specific parser from my little knowledge of how tree sitter works.
Additional context
This alternative to Doxygen: https://github.com/jnikula/hawkmoth
The text was updated successfully, but these errors were encountered: