Complete local bindings from the surrounding form#58
Merged
Conversation
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.
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.
The static source ignored the completion context, so it could never complete a local
let/fn/forbinding - one of the more basic things compliment does for Clojure. It now feeds the context to compliment's ownlocal-bindingsextractor.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
:taginference, 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 viacompliment.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.