Optimize cider-get-ns-name for clojure-ts-mode buffers#3920
Merged
bbatsov merged 1 commit intoMay 18, 2026
Merged
Conversation
Using clojure-ts-find-ns is a bit more efficient as it leverages tree-sitter. Plus, there seem to be some egde cases where clojure-find-ns within a clojure-ts-mode buffer makes Emacs hang, as clojure-find-ns's (while t (up-list nil t t)) loop never terminates because up-list delegates to treesit-forward-sexp, which not always seem to signal an error.
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using
clojure-ts-find-nsis a bit more efficient as it leverages tree-sitter.Plus, there seem to be some egde cases where
clojure-find-nswithin aclojure-ts-modebuffer makes Emacs hang, asclojure-find-ns's(while t (up-list nil t t))loop never terminates becauseup-listdelegates totreesit-forward-sexp, which not always seems to signal an error.Unfortunately I wasn't able to reproduce the error case. But as the change is a performance improvement as well, I hope this is acceptable.