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

[Draft] - Tree Sitter Service (POC) #147648

Closed
wants to merge 2 commits into from

Conversation

jasonwilliams
Copy link
Contributor

This PR creates a new contributionPoint called tsGrammars which can be used to load a new tree sitter grammar, similar to AnyCode contribution points.

There is a new service which picks up the grammar for whichever active language and then loads it into the parser, that tokenization instance can then handle tokenizing source code.

Some issues:

Native node tree sitter doesn't seem to work with electron due to this issue: tree-sitter/node-tree-sitter#90

So I've got as far as setting up a new service which instantiates and attempts to load web-tree-sitter, however it's unable to load due to a security policy:

vscode\node_modules\web-tree-sitter\tree-sitter.js:1 Refused to connect to 'vscode/node_modules/web-tree-sitter/tree-sitter.wasm' because it violates the following Content Security Policy directive: "connect-src 'self' https: ws:".

I don't know the codebase well enough to properly configure this and put web-tree-sitter in the right place.

This PR fixes #50140
This PR fixes #216

@jasonwilliams jasonwilliams changed the title [Draft] - Tree Sitter Service [Draft] - Tree Sitter Service (POC) Apr 18, 2022
@aeschli aeschli assigned alexdima and unassigned aeschli Apr 25, 2022
@emm312
Copy link

emm312 commented Jul 15, 2022

Any updates on this PR?

@jasonwilliams
Copy link
Contributor Author

Hey @alexdima do you have any advice?

@alexdima
Copy link
Member

alexdima commented Oct 7, 2022

@jasonwilliams We have had an exploration done by @aiday-mar for using Tree Sitter as a syntax highlighting engine. For the purpose of the exploration we have been mostly interested in finding out what would be the potential speed / memory savings that Tree Sitter could bring. Please see #161479 for the exploration outcome. To productize this and allow extensions to contribute .wasm files we will first need to figure out what to do with Tree Sitter's parser ABI versioning, which increases every now and then and which breaks our desire to never break vscode extensions.

@jasonwilliams
Copy link
Contributor Author

In that case I will close this in favour of #161479 @alexdima i don't know too much about the ABI versioning, but are there breaking changes happening a lot?

@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2022
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.

Support syntax highlighting with tree-sitter [grammars] provide alternative to TextMate grammars
4 participants