Closed TatriX closed 7 years ago
Usually company mode will run a completion after a short delay if there are more then company-minimum-prefix-length
characters in the prefix.
(add-hook 'after-init-hook 'global-company-mode)
(global-set-key (kbd "C-M-i") 'company-complete)
I believe users don't need company mode to use the skewer-mode.
When buffer enters the skewer-repl-mode
it just sets local variable:
(setq-local company-backends '(company-skewer-repl))
So if user has company mode installed it completion should work out of the box. If no company mode available nothing happens.
Opportunistic use of company-mode is perfect! I've merged with additional changes.
I wrapped the three places it touches company-mode with with-no-warning
to keep the compiler quiet. All three are perfectly safe without company-mode being loaded.
I moved the JavaScript out into skewer.js. It's now a formal Skewer "method" called completions
. The string-building hack is no longer necessary and accessing completions is a lot simpler:
(skewer-eval-synchronously "document.location"
:type "completions"
:extra '((regexp . "^h")))
;; => ((value . ["href" "host" "hostname" "hash"])
;; (status . "success")
;; (type . "completions")
;; (id . "24219a5f06cbc5c"))
skewer-repl--get-completion-expression
returns nil instead of window
. This is because an arg
of of "window"
is fundamentally different than an arg
that needs to consult window
, and they must be handled differently. Without this there's also the funky issue where an arg
of "document"
returned "window"
and then pattern
ends up as "t"
because the substring goes off the length of "window"
. This fixes top-level completions.Awesome, thank you!
Thanks for giving this a shot. There are two minor things still needed:
(require 'company)
and addingcompany
(0.9.2?) as a new dependency in skewer-mode-pkg.el.But more importantly, how do I use this? I've never used
company-mode
before. I fired up the REPL, enabled company-mode, and can't really get it to do anything. I can tell roughly what it's doing — figuring out the name of the object to query and fetching its properties — but I don't know how that connects to company-mode.