- Notifications
You must be signed in to change notification settings - Fork18
Switch to experimental Clojure grammar#99
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Switch to experimental Clojure grammar#99
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Before we were trying to align multiple nodes starting from the top-level nodeand moving to the most deeply nested node. This could produce misaligned formsif nested nodes have extra spaces that has to be cleaned up. Now we start fromthe most deeply nested node and gradually move to the top of the tree.
rrudakov commentedMay 26, 2025
@bbatsov, could you please take a look? |
bbatsov commentedMay 26, 2025
Sure. At a glance the PR looks OK, but I'll take a deeper look tomorrow, as the changes are quite extensive. You can close#98 and perhaps add some notes to the README that we're using a modified version of the upstream grammar and our reasoning for doing this. Probably some of this should also go in some form to the design document. |
rrudakov commentedMay 26, 2025
This is already done, but let me know if I should extend it further. |
rrudakov commentedMay 26, 2025
Yeah... I'm still struggling to even start with that :) |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
bbatsov commentedMay 27, 2025
For the README that's fine, but for the design doc I'd probably mention the summary from the end of the discussion about the creation of the experimental grammar. Overall the PR seems to be in a good shape to me, but I left small remarks here and there. |
Uh oh!
There was an error while loading.Please reload this page.
rrudakov commentedMay 27, 2025
I fixed all the mentioned issues and updated the design documentation. |
cb2cb18 intoclojure-emacs:mainUh oh!
There was an error while loading.Please reload this page.
sogaiu commentedMay 29, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Not sure if it's pilot error on my end, but my Emacs 30.1 doesn't seem to have the function (defunclojure-ts--clojure-grammar-outdated-p ()"Return TRUE if currently installed grammar is outdated.This function checks if`clojure-ts-mode' is compatible with thecurrently installed grammar. The simplest way to do this is to validatea query that is valid in a previous grammar version but invalid in therequired version." (treesit-query-valid-p'clojure '((sym_lit (meta_lit))))) I think it got added to Emacs inthis commit. It looks like it got added in 2025-01 (before Emacs-30.1 was released), but may be it didn't make it in? I don't see it via Fairly short implementation though... (defuntreesit-query-valid-p (languagequery)"Return non-nil if QUERY is valid in LANGUAGE, nil otherwise." (ignore-errors (treesit-query-compile language queryt)t)) |
bbatsov commentedMay 29, 2025
Hmm, seems I don't have it as well. It's interesting that lint job didn't catch this... |
rrudakov commentedMay 29, 2025
Wow, that's surprising. I should have tested it on Emacs 30. Should we just copy the implementation directly to |
bbatsov commentedMay 29, 2025
@rrudakov I guess that would be the simplest thing for now. Hopefully it will be included in 30.2 - I heard it's right around the corner, but I'm not sure what's going to land there. |
rrudakov commentedMay 29, 2025
I'll create a PR shortly. |
Following thesogaiu/tree-sitter-clojure#65 discussion.
This PR contains a set of commit that accumulated while we were discussing changes in the grammar.
definterface,extend-typeetc).clojure-ts-align+ slight performance optimization by pre-compiling the query.clojure-ts-unwind.This includes the changes from#98, so if this one is merged, I'll close the other one.
Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):
M-x checkdocand fixed any warnings in the code you've written.Thanks!