Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept of "side channel" for diagnostics #639

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alanz
Copy link

@alanz alanz commented Feb 2, 2021

Replaces ReaderC with StateC in Unmarshal, and checks for diagnostics
at 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 and ts_node_is_missing_p calls are not the right ones, the detailed info comes from the logic in
https://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

alanz and others added 5 commits February 2, 2021 23:05
Replaces ReaderC with StateC in Unmarshall, and checks for diagnostics
at 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.
Use a modified tree-sitter to retrieve diagnostics for a Node as a
string, parse it into a TSDiagnostic type and byte-offset, and return
them in the side channel.
@github github deleted a comment Aug 23, 2021
@patrickt patrickt dismissed a stale review via 484decb August 24, 2021 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant