cljs-tooling icon indicating copy to clipboard operation
cljs-tooling copied to clipboard

Compliment-like features

Open bbatsov opened this issue 11 years ago • 12 comments

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:

  • context aware completion
  • fuzzy completion

I guess those should be straightforward to port?

bbatsov avatar Jun 08 '14 11:06 bbatsov

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

cichli avatar Jun 17 '14 17:06 cichli

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

bbatsov avatar Feb 26 '15 06:02 bbatsov

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 avatar Mar 02 '15 18:03 cichli

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

cichli avatar Mar 02 '15 18:03 cichli

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 avatar Mar 03 '15 22:03 bbatsov

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

bbatsov avatar Mar 03 '15 22:03 bbatsov

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

cichli avatar Mar 05 '15 09:03 cichli

Any progress here?

bbatsov avatar Dec 12 '15 15:12 bbatsov

I guess not. :-)

bbatsov avatar Jan 08 '17 10:01 bbatsov

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

dpsutton avatar Jan 08 '17 16:01 dpsutton

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

bbatsov avatar Jan 08 '17 17:01 bbatsov

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

MalloZup avatar Aug 05 '19 21:08 MalloZup