Skip to content

Fix the offline ns sort doing nothing in clojure-ts-mode - #603

Merged
bbatsov merged 1 commit into
masterfrom
sort-ns-in-ts-mode
Jul 16, 2026
Merged

bbatsov merged 1 commit into
masterfrom
sort-ns-in-ts-mode

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 16, 2026

Copy link
Copy Markdown
Member

In a clojure-ts-mode buffer the offline ns-form sort (cljr-clean-ns without a REPL, and cljr-auto-sort-ns) reported success while changing nothing: clojure-ts-mode's tree-sitter forward-sexp-function silently breaks clojure-sort-ns's syntax-table-based walk. Force the default sexp movement around the sort - the same idiom clojure-mode uses internally in clojure-forward-logical-sexp. The proper fix probably belongs in clojure-sort-ns itself; this shields our call sites until that lands.

Verified in a live clojure-ts-mode buffer (with the grammar installed); the test simulates the hostile forward-sexp-function since CI has no tree-sitter grammars.

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • The new code is not generating byte compile warnings (run make compile)
  • All tests are passing (run make test)
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the readme (if adding/changing user-visible functionality)

clojure-ts-mode installs a tree-sitter forward-sexp-function, which
turns clojure-sort-ns's syntax-table-based walk into a silent no-op:
cljr-clean-ns without a REPL reported success while leaving the ns
form untouched (same for cljr-auto-sort-ns). Force the default sexp
movement around the sort. The proper fix belongs in clojure-sort-ns
itself; this shields our two call sites until that lands.
@bbatsov
bbatsov merged commit 61d131b into master Jul 16, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant