Add Tree-sitter Query language#7243
Conversation
vendored vscode-tree-sitter-query
|
I recall @lildude mentioned that the decision to do tree-sitter syntax highlighting is handled internally however the grammar in https://github.com/tree-sitter-grammars/tree-sitter-query is one of the most performant grammars out there (and is what the highlighting is based off of). Tree-sitter Query Rust: |
lildude
left a comment
There was a problem hiding this comment.
Please also address the test failures.
lildude
left a comment
There was a problem hiding this comment.
See inline comments.
The classifier failure is because it is determining Tree-sitter Query/injections.scm is Scheme:
Tree-sitter Query/injections.scm BAD (Scheme)
This will be because it's quite a small sample and because there is only one very small Scheme .scm sample being used to train the classifier. I recommend experimenting (locally) with adding a few more larger more representative Scheme samples to better train the classifier... the more different they look from Tree-sitter Query files, the better.
lib/linguist/heuristics.yml
Outdated
| - '(?:''[\(\w\*]|[\w\-]+->[\w\-]+|\b\.\.\.\b|\([+\-#:<>\/=~\)]|~>)' | ||
| - '^#:\w+' | ||
| - '#\w*\(' | ||
| - '^\s*\((?i:define|import|library|let)' |
There was a problem hiding this comment.
This is vulnerable to ReDoS attack. Please fix it, and ensure the new regex runs linearly and is a Re2-style regex. See #7242 for other regexes we're slowly cleaning up.
There was a problem hiding this comment.
Are all the pattern entries joined by a | or evaluated separately? Does pattern: ['a*', 'b*'] become pattern: '(a*|b*)'?
There was a problem hiding this comment.
You can find the magic here.
My finding was based purely on testing the first regex in isolation 😉
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
No. That has no effect on the classifier tests. The classifier is only influenced by the samples themselves. More samples == better training.
You don't want to do that. This is about testing a specific heuristic which is tied to an extension. |
This comment was marked as resolved.
This comment was marked as resolved.
8e553ac to
fbfe049
Compare
remove unneeded assertion
|
@lildude are we waiting on any feedback to be addressed? |
Description
This PR adds support for the Tree-sitter Query language and attempts to resolve #5746
Checklist:
#8ea64c