-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Another batch of Clojure enhancements #729
Conversation
…re-grammar-enhancements
Looks like this is still set up for the legacy tree-sitter implementation, it would need to use the It also looks like this adds some new functions to some base files - won't those potentially break other tree-sitter grammars? |
@Spiker985 there's no legacy Clojure tree-sitter actually, so I'm unsure what you mean with this options. As for the new options, they are just new things we support, if other grammars don't use these they won't be affected. But before everything, I need to fix these grammars (or even remove what I did) - injection points are not correct, and they are janky when editing these forms... |
|
The changes introduced to core don't change how any existing features behave. We've got
If the tests pass, I'm good. |
We can try merging in the macOS CI fix from |
// the second,third,etc argument | ||
ancestorTypeNearerThan(node, types) { | ||
let [target, ...rejected] = types.split(/\s+/); | ||
rejected = new Set(rejected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're almost certainly not better off converting the rest to a Set
. Maybe if you were caching these items by string value (which might not be a bad idea), but otherwise I suspect it's quicker to keep the rest as an array and do a rejected.includes(current.type)
test instead.
Probably not a huge deal, but I'd suggest doing a profiling stress test here. Any predicate that loops is worth optimizing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I did profile - it indeed makes no difference, so I went with the Set
because it's simpler.
What I found is that what a lot of nodes (like, 1 million tests for example) the Set
implementation is faster, even when the Set contains 1 or 2 elements only. But Pulsar doesn't even supports 1 million "parent" nodes, so we're safe here :)
Co-authored-by: Andrew Dupont <github@andrewdupont.net>
Co-authored-by: DeeDeeG <DeeDeeG@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More or less rubber-stamp approved from me, hopefully others on the team with more knowledge in this area are happy with the PR now as well?
If they have any feedback, I defer to them, however.
Replaces #663 because this is more complete.
That was a journey, but basically Clojure highlights some interesting things:
Missing: