summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el32
1 files changed, 30 insertions, 2 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 0a8663b3..f4995688 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -3,7 +3,8 @@
 (defvar default-file-name-handler-alist file-name-handler-alist)
 (setq file-name-handler-alist nil
       gc-cons-threshold most-positive-fixnum
-      gc-cons-percentage 0.6)
+      gc-cons-percentage 0.6
+      read-process-output-max (* 4 1024 1024))
 (defun set-max-gc-cons ()
   (setq gc-cons-threshold most-positive-fixnum))
 (defun set-default-gc-cons ()
@@ -1045,7 +1046,6 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
             yaml-mode-hook
             js-base-mode-hook
             css-base-mode-hook
-            go-mode-hook
             lua-mode-hook
             nim-mode-hook
             html-mode-hook
@@ -1085,6 +1085,34 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :commands (consult-eglot-symbols)
   :after eglot)
 
+(use-package lsp-mode
+  :defer 3
+  :ghook ('(go-mode-hook)
+          #'lsp-deferred)
+  ('lsp-mode-hook #'lsp-enable-which-key-integration)
+  :config (progn
+            (setq lsp-auto-guess-root t
+                  lsp-auto-execute-action nil
+                  lsp-headerline-breadcrumb-enable nil
+                  lsp-enable-suggest-server-download nil)
+
+            (lsp-register-custom-settings
+             '(("golangci-lint.command"
+                ["golangci-lint" "run" "--out-format" "json" "--issues-exit-code=1"])))
+
+            (lsp-register-client
+             (make-lsp-client :new-connection (lsp-stdio-connection
+                                               '("golangci-lint-langserver"))
+                              :activation-fn (lsp-activate-on "go")
+                              :language-id "go"
+                              :priority 0
+                              :server-id 'golangci-lint
+                              :add-on? t
+                              :library-folders-fn #'lsp-go--library-default-directories
+                              :initialization-options (lambda ()
+                                                        (gethash "golangci-lint"
+                                                                 (lsp-configuration-section "golangci-lint")))))))
+
 ;; Inside a javascript project, it's common to install tools locally to
 ;; the project.  This will allows emacs to find their executables.