Procedure to find all CST nodes in a given source range? #1656
Unanswered
mlyoung101
asked this question in
Q&A
Replies: 1 comment
|
slang doesn't store a mapping in that direction, so you'd have to build it yourself. Tools like https://github.com/hudson-trading/slang-server have to do this to provide an editor experience where you can click on a token and find it via source offset. Also note that slang has a |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm trying to add a feature to my project that will allow the user to ignore certain diagnostics with a comment, similar to clang-tidy's
NOLINTNEXTLINE.I know that I can use the trivia attached to CST nodes to read the comment, so that's fine; but how can I actually find all the CST nodes that are within a given source range? The source range is provided by the diagnostic.
Alternatively, is it possible to query the exact CST token the diagnostic refers to, and then I can just walk it's hierarchy?
Cheers :)
All reactions