Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

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

Closed
wants to merge 5 commits into 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
@CleanCut CleanCut closed this Apr 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants