all repos — nixfiles @ dbc511cc2326c74dc6dba5b5a712ba3c52311f8e

System and user configuration, managed by nix and home-manager

golang: install and configure lang servers

Alan Pearce
commit

dbc511cc2326c74dc6dba5b5a712ba3c52311f8e

parent

2c5665edeb0c5546e5e60d6ccb85731fe06bc83b

2 files changed, 13 insertions(+), 2 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -1040,9 +1040,16 @@ (s-starts-with-p "Connected!" formatstring)))
(defun my/setup-eglot-eldoc () (push 'flymake-eldoc-function eldoc-documentation-functions)) (add-hook 'eglot-managed-mode-hook 'my/setup-eglot-eldoc) + (setf (alist-get '(go-mode go-dot-mod-mode go-dot-work-mode go-ts-mode go-mod-ts-mode) + eglot-server-programs + nil nil #'equal) + (eglot-alternatives '("golangci-lint-langserver" + "gopls" ))) (setq-default eglot-workspace-configuration - '(:yaml (:keyOrdering nil) - :nix (:autoArchive t)) + '( :yaml (:keyOrdering nil) + :nix (:autoArchive t) + :gopls ( :staticcheck t + :usePlaceholders t)) eglot-ignored-server-capabilities '(:documentHighlightProvider)) (defun my/eglot-capf () (setq-local completion-at-point-functions
@@ -1095,6 +1102,8 @@ (setf (alist-get 'shfmt apheleia-formatters)
'("shfmt")) (setf (alist-get 'nixfmt apheleia-formatters) '("nixpkgs-fmt")) + (setf (alist-get 'go-ts-mode apheleia-mode-alist) + '(goimports)) (add-hook 'apheleia-mode-hook #'turn-off-format-all-mode)) :init (progn (apheleia-global-mode +1)))
M user/settings/development/golang.nixuser/settings/development/golang.nix
@@ -4,6 +4,8 @@ go
gopls gotools golines + golangci-lint + golangci-lint-langserver ]; programs.emacs.extraPackages = epkgs: (with epkgs; [ go-eldoc