简体   繁体   中英

Emacs + cider: Autocomplete defprotocol methods. Possible or not?

Is it possible to have autocompletion of defprotocol methods in Emacs?

An example:

(defprotocol Foo
  (bar [this])
  (baz [this])

(deftype Qux [a b c]
  Foo
  (bar [this] a)
  (baz [this] b))

(bar (Qux. 1 2 3))
(baz (Qux. 1 2 3))

I was looking for something like this(in pseudocode):

;; (1)
(`M-Tab` (Qux. 1 2 3)) 
;;
;; or (2):
(-> (Qux. 1 2 3) `M-Tab`)

to trigger a dropdown with bar & baz options. As a workaround I'm currently using (2) but it needs to have at least 1st character to be present(autocomplete all options doesn't work).

Is there a better way to do it? Thanks

For me auto-completion also works in case (1) when one character is present. It does not seem to specifically be aware of the functions belonging to the protocol, CIDER is just aware of the functions in scope. The completion-at-point does not seem to toggle without a first character. Maybe you can try asking on #cider of clojurians.slack.org?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM