From e84bd902626aa00a993b865e1faa751bb84b7c3d Mon Sep 17 00:00:00 2001 From: Tim Heckman Date: Sat, 9 Mar 2019 03:43:35 -0800 Subject: [PATCH] Set lsp-prefer-flymake to :none when Go layer is using LSP When switching the Go layer to use the LSP backend with `golangci-lint`, I noticed that none of my linter errors were being rendered with my source code. Digging in further, I eventually learned it was due to `lsp-prefer-flymake` being set to `nil` and not `:none`. This change updates the Go layer, when using LSP and golangci-lint, to set `lsp-prefer-flymake` to `:none`. If this is not set, the golangci-lint errors will not be reported. This is an alternative to #12043. Fixes #11680 Signed-off-by: Tim Heckman --- CHANGELOG.develop | 2 ++ layers/+lang/go/funcs.el | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.develop b/CHANGELOG.develop index d5845d4e6..b3ea5e17a 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -1300,6 +1300,8 @@ Other: - Added lsp support (thanks to Lupco Kotev) - Added golangci-lint support (thanks to Lupco Kotev) - Add toggle control for verbose go test output (thanks to Enze Chi) +- Set lsp-prefer-flymake to :none when Go layer is using LSP (thanks to Tim + Heckman) **** Graphviz - Use graphviz package from melpa (thanks to Matthew Boston) **** Groovy diff --git a/layers/+lang/go/funcs.el b/layers/+lang/go/funcs.el index 9778a5fda..a9064f38c 100644 --- a/layers/+lang/go/funcs.el +++ b/layers/+lang/go/funcs.el @@ -37,7 +37,13 @@ (defun spacemacs//go-setup-backend-lsp () "Setup lsp backend" (if (configuration-layer/layer-used-p 'lsp) - (lsp) + (progn + ;; without setting lsp-prefer-flymake to :none + ;; golangci-lint errors won't be reported + (when go-use-golangci-lint + (message "[go] Setting lsp-prefer-flymake :none to enable golangci-lint support.") + (setq-local lsp-prefer-flymake :none)) + (lsp)) (message "`lsp' layer is not installed, please add `lsp' layer to your dotfile."))) (defun spacemacs//go-setup-company-lsp ()