zls icon indicating copy to clipboard operation
zls copied to clipboard

Use with eglot in emacs

Open foggy1 opened this issue 4 years ago • 2 comments

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.

  1. Has anybody got this working successfully with eglot?
  2. What's the best way for me to tell if zlsis working in emacs with the default settings?

foggy1 avatar Oct 26 '20 17:10 foggy1

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)

ilohmar avatar Nov 12 '22 14:11 ilohmar

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.

jonasagx avatar Feb 04 '24 05:02 jonasagx