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

Vendor tree-sitter parsers #1028

Closed
rien opened this issue Jan 24, 2023 · 2 comments · Fixed by #1291
Closed

Vendor tree-sitter parsers #1028

rien opened this issue Jan 24, 2023 · 2 comments · Fixed by #1291

Comments

@rien
Copy link
Member

rien commented Jan 24, 2023

We currently use tree-sitter to have parsers for a broad range of programming languages. We provide a list of "supported languages" for which we guarantee that they should work, but we also claim that extra languages should be easy to install.

In practice however, this has some problems: parsers make releases at a different pace, which causes them to have incompatible language versions. Some parsers are not released on npm at all (r-lib/tree-sitter-r#41).

One possible solution is providing our own package @dodona/dolos-parsers where we would vendor a large list of languages, giving us more control and agility. This approach is based on that of https://github.com/Wilfred/difftastic which does something similar for a Rust tool. However, since tree-sitter requires to be built natively for node using node-gyp, we would need to add an extra layer on top of that which will build all the parsers.

@ahan98
Copy link

ahan98 commented Oct 20, 2023

Hi, I'd like to use Dolos for the R language. Since its parser is not on npm, does that mean integration with Dolos is not currently possible? I've installed tree-sitter-r locally by cloning it in my node_modules directory, as instructed in the Dolos documentation, but dolos run -l r *.R still doesn't work.

@rien
Copy link
Member Author

rien commented Oct 20, 2023

Integration is possible, but you need to jump through some hoops unfortunately.

You can install the parser using the command npm install https://github.com/r-lib/tree-sitter-r which will clone the repository in node_modules, but it will also build the native binaries.

If you've already cloned the repository, you still need to run npm install and npm build inside it, I think. However, removing it and installing the repository directly using npm install will be easier.

@rien rien linked a pull request Oct 26, 2023 that will close this issue
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 a pull request may close this issue.

2 participants