zls
zls copied to clipboard
Use with eglot in emacs
I use eglot
instead of lsp-mode
in emacs. I'd like to run zls
the way I run other language servers, e.g. (add-to-list 'eglot-server-programs '(zig-mode "path/to/zls"))
. If I understand eglot
correctly, this should get me most of the way there; if that's not true, I'll take it up with eglot
.
- Has anybody got this working successfully with
eglot
? - What's the best way for me to tell if
zls
is working in emacs with the default settings?
That should indeed tell eglot to use zls
in zig-mode
. You also have to run eglot
for each .zig
file, try it with M-x eglot
: You should see a changed display in the buffer's modeline. To automatically run zls for zig files, add to your init file
(add-hook 'zig-mode-hook #'eglot-ensure)
Here is a simple way to config it via use-package:
(use-package eglot
:hook
(zig-mode . eglot-ensure)
:config
(setq eglot-autoshutdown t)
(add-to-list 'eglot-server-programs '(zig-mode . ("zls")))) ;; make sure zls is installed
once Eglot runs for your zig file you should see a buffer with logs from zig-mod and Eglot.
I assume this issue can be closed now.