Proof of concept of "side channel" for diagnostics #639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces
ReaderC
withStateC
inUnmarshal
, and checks for diagnosticsat each visited node, kept in the state.
The diagnostic determination is dodgy, but the concept works
See https://gist.github.com/alanz/2ae23a75bba75ed09780d3fa043bd28e
Note: haskell-tree-sitter is a git dep, it needs a
"git submodule update" in the appropriate "dist-newstyle/src" directory.
Related issues: #574 #638 .
Alternative approaches are to extend the query capabilities, as requested in tree-sitter/tree-sitter#606
The
ts_node_has_error
andts_node_is_missing_p
calls are not the right ones, the detailed info comes from the logic inhttps://github.com/tree-sitter/tree-sitter/blob/2b0de9dfec62af7e74c319abe80912b02dca74be/lib/src/subtree.c#L846-L894
and
https://github.com/tree-sitter/tree-sitter/blob/2b0de9dfec62af7e74c319abe80912b02dca74be/lib/src/language.c#L67-L80