I see on the front page of https://github.com/tigersoldier/company-lsp when you type the function name it autocompletes not just the rest of the name, but the signature as a snippet, enabling you to tab to the args and fill them in.
That's not working for me, and I'm not sure why. (Not even sure which package is providing those signature snippets.) Here's a short emacs init file I'm using to test:
(require 'package)
(package-initialize)
(require 'use-package)
(setq use-package-verbose t)
(use-package yasnippet
:ensure t
)
(use-package company
:ensure t
:demand
:bind (("M-RET" . company-complete))
:config
(global-company-mode)
)
(use-package lsp-mode
:ensure t
:commands lsp
:hook ((vue-mode . lsp)
(typescript-mode . lsp)
(python-mode . lsp))
:config
(setq lsp-prefer-flymake t)
)
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode
:hook (lsp-mode . lsp-ui-mode)
)
(use-package company-lsp
:ensure t
:config
(push 'company-lsp company-backends)
;; Disable client-side cache because the LSP server does a better job.
(setq company-transformers nil
company-lsp-async t
company-lsp-cache-candidates nil)
)
If I have a typescript file like this:
function foo1(a: number, b: number) {
return a+b
}
function foo2(a: number) {
return a % 2 == 0
}
function main() {
foo
with the cursor at the end of the last "foo", I do get the popup with possible completions, but when I select one I don't get the signature like in the gif on the company-lsp home page. I do get the doc in the minibuffer with the current arg highlighted as I type, so I know the info is in there somewhere!
javascript-typescript-langserver
but I was actually usingtypescript-language-server
, which apparently doesn't support completion snippets.