Skip to content

Complete local bindings from the surrounding form#58

Merged
bbatsov merged 1 commit into
masterfrom
local-bindings-completion
Jul 12, 2026
Merged

Complete local bindings from the surrounding form#58
bbatsov merged 1 commit into
masterfrom
local-bindings-completion

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 12, 2026

Copy link
Copy Markdown
Member

The static source ignored the completion context, so it could never complete a local let/fn/for binding - one of the more basic things compliment does for Clojure. It now feeds the context to compliment's own local-bindings extractor.

The nice part: that extractor is purely structural (it recognizes binding forms by name and walks the destructuring), so it works for ClojureScript unmodified. The only Clojure-specific bits are optional :tag inference, which degrades to nil for cljs without throwing. So this is reuse rather than a reimplementation.

Locals come back shaped exactly like compliment's (:type :local, no :priority). The source also learned to accept a raw context string and parse it via compliment.context, for callers that don't pre-parse.

Covered by new tests (let bindings, fn args, destructuring, and the no-context case), green under CLJS 1.11 and 1.12.

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

The static source ignored the completion context entirely, so it could
never complete a let/fn/for local - a basic thing compliment does for
Clojure. It now feeds the context to compliment's own local-bindings
extractor, which is purely structural (it recognizes the binding forms by
name and walks the destructuring), so it works unchanged for cljs.

Locals are matched and shaped exactly as in compliment (:type :local, no
:priority). The source now also accepts a raw context string, parsing it
via compliment.context, for callers that don't pre-parse.
@bbatsov bbatsov merged commit 66741e3 into master Jul 12, 2026
8 of 9 checks passed
@bbatsov bbatsov deleted the local-bindings-completion branch July 12, 2026 09:55
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