Open bbatsov opened 10 years ago
We can definitely mirror the contextual completion in ns declarations (see ns_mappings.clj in compliment). It'll take a bit of tweaking since ns
is a little different in Clojurescript, but it's fundamentally the same.
Fuzzy matching should be easy; we just need to switch out the following line in complete.clj:
(filter #(.startsWith % prefix))
Well, I'd love to see this for cljs and I know many other people would love to see it as well. :-)
I actually have a branch with flx-like fuzzy completion (using Damerau-Levenshtein and a QuickSilver-like algorithm) - the problem I encountered is that emacs has completion-styles
now, so a lot of the fuzzy matches get filtered out. We'd need a client option to tell CIDER to use its own fuzzy matching and ignore completion-styles
.
These algorithms are also inherently tunable - should we let users pick the scoring thresholds? If so it might be best to return all potential candidates to the middleware and have the fuzzy-matching logic there (so the same client settings apply to both clj and cljs).
The other option is to return all potential candidates to emacs and let completion-styles
filter them, but some caching would need to occur. It's noticeably sluggish if the backend returns all potential candidates that often. Even with caching, doing flx-like matching in emacs is probably too slow regardless - see company-mode/company-mode#47 - so I think this option is out (unless you think the built-in initials
completion style is good enough).
I will work on the ns-form / locals contextual completion, though :-).
We'd need a client option to tell CIDER to use its own fuzzy matching and ignore completion-styles.
Makes sense to me.
These algorithms are also inherently tunable - should we let users pick the scoring thresholds? If so it might be best to return all potential candidates to the middleware and have the fuzzy-matching logic there (so the same client settings apply to both clj and cljs).
I'd suggest keeping things simple and just returning whatever compliment
and cljs-tooling
are computing. Perhaps we can adjust this down the road.
The other option is to return all potential candidates to emacs and let completion-styles filter them, but some caching would need to occur. It's noticeably sluggish if the backend returns all potential candidates that often. Even with caching, doing flx-like matching in emacs is probably too slow regardless - see company-mode/company-mode#47 - so I think this option is out (unless you think the built-in initials completion style is good enough).
I'm definitely not a fan of this approach.
Btw, a related ticket https://github.com/clojure-emacs/cider/issues/467
@bbatsov I'll rebase the fuzzy-completion branch once #16 is merged.
Any progress here?
I guess not. :-)
@cichli is there any chance you still have this branch?
Likely this is the only commit in this branch - https://github.com/cichli/cljs-tooling/commit/352f42cd2c459d7bc0a98b0a6ec7e76377cce911
autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it
In order to provide a similar experience for users of both Clojure and ClojureScript it'd be nice if the completion handling code supported several compliment features:
I guess those should be straightforward to port?