-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add positive field
query syntax
#4456
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
base: master
Are you sure you want to change the base?
Conversation
How is this a fix/workaround for query serialization or the slow query parsing issues? |
the slow query (parent (childA) (childB) (childC))
(parent (childA) (childC) (childB))
(parent (childB) (childA) (childC))
(parent (childB) (childC) (childA))
(parent (childC) (childA) (childB))
(parent (childC) (childB) (childA)) can be replaced with the much faster (parent &childA &childB &childC) query serialization isn't needed as badly if all queries are fast wow github... |
I guess, but I personally wouldn't consider this a workaround because this specific case isn't the cause for the truly horrendously slow query parses (which are covered by #4042) |
Also is this for fields or children? I thought the ! syntax applied to field names but it looks like in your example it is meant to test for the existence of nodes, rather than fields |
(parent &fieldA &fieldB &fieldC) |
? ok you can change the names of the hypothetical fields but I'm just saying that this: (parent &childA &childB &childC) is not equivalent to this:
if this_is_a_field: (this_is_a_node) That said, I'm not sure this PR works as intended. Would you mind adding some tests for the behavior (not just for syntax errors)? |
I am now able to build and test the PR
ik I replaced this old query: (https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/015b41533fbfda48e881f0af0101e0b51036bde4/src/DiagnosticCollection.ts#L547-L581) (repo
[(include) (patterns)] (repository
(repo
(key) @nestRepo))
!match !begin)
(repo
(repository
(repo
(key) @nestRepo)) [(include) (patterns)]
!match !begin)
(pattern
(patterns) (repository
(repo
(key) @nestRepo))
!match !begin !include)
(pattern
(repository
(repo
(key) @nestRepo)) (patterns)
!match !begin !include)
(capture
(patterns) (repository
(repo
(key) @nestRepo))
!match !begin)
(capture
(repository
(repo
(key) @nestRepo)) (patterns)
!match !begin) with this new one: (repo
&include (repository
(repo
(key) @nestRepo))
!match !begin)
(repo
&patterns (repository
(repo
(key) @nestRepo))
!match !begin !include)
(pattern
&patterns (repository
(repo
(key) @nestRepo))
!match !begin !include)
(capture
&patterns (repository
(repo
(key) @nestRepo))
!match !begin) the old one took 4200ms to compile while the new one compiles in just 22ms, 190x times faster and I was able to improve this query as well (https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/015b41533fbfda48e881f0af0101e0b51036bde4/src/DiagnosticCollection.ts#L754-L794) I will look into creating tests soon |
I've added a working |
Fixed merge conflict even tho there was no conflict..... github?? |
there was a conflict (#4496) |
|
Fixes #3956
possible Fixes/Workaround for:
TSQuery
#1942I've just copy pasted the negative fields syntax
!field
changing:
negative
topositive
!
to&
https://github.com/tree-sitter/tree-sitter/pull/4456/files#diff-cfcaac4236741ab3da24a7768f96bba49ae7382f054c0e7757d78862c44ec9d5R4013
using #983 reference