clojure-emacs / cljs-tooling

[DEPRECATED] Tooling support for ClojureScript
60 stars 10 forks source link

Compliment-like features #10

Open bbatsov opened 10 years ago

bbatsov commented 10 years ago

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?

cichli commented 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))
bbatsov commented 9 years ago

Well, I'd love to see this for cljs and I know many other people would love to see it as well. :-)

cichli commented 9 years ago

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).

cichli commented 9 years ago

I will work on the ns-form / locals contextual completion, though :-).

bbatsov commented 9 years ago

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.

bbatsov commented 9 years ago

Btw, a related ticket https://github.com/clojure-emacs/cider/issues/467

cichli commented 9 years ago

@bbatsov I'll rebase the fuzzy-completion branch once #16 is merged.

bbatsov commented 8 years ago

Any progress here?

bbatsov commented 7 years ago

I guess not. :-)

dpsutton commented 7 years ago

@cichli is there any chance you still have this branch?

bbatsov commented 7 years ago

Likely this is the only commit in this branch - https://github.com/cichli/cljs-tooling/commit/352f42cd2c459d7bc0a98b0a6ec7e76377cce911

MalloZup commented 5 years ago

autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it