feat(lang): format go-mode buffers on save with gofumpt via lsp-mode

Also tweak a couple of other gopls settings, and set a others to their
defaults for the purpose of ensuring they stay that way, and also to
make it more obvious within emacs what options are available.
This commit is contained in:
2020-10-29 13:12:01 +00:00
parent 2c4f996672
commit 7ca255db9c

View File

@@ -52,6 +52,8 @@
:config
(when (not (getenv "GOPATH"))
(exec-path-from-shell-copy-env "GOPATH"))
(when (not (getenv "GOPRIVATE"))
(exec-path-from-shell-copy-env "GOPRIVATE"))
(when (not (getenv "GOENV_GOPATH_PREFIX"))
(exec-path-from-shell-copy-env "GOENV_GOPATH_PREFIX"))
@@ -64,7 +66,22 @@
:straight lsp-mode
:hook
(go-mode . lsp-deferred))
(go-mode . lsp-deferred)
:custom
(lsp-go-use-placeholders nil)
(lsp-go-link-target "pkg.go.dev")
:init
(lsp-register-custom-settings
'(("gopls.completeUnimported" t t)
("gopls.completionBudget" "100ms")
("gopls.completionDocumentation" t t)
("gopls.deepCompletion" t t)
("gopls.gofumpt" t t)
("gopls.matcher" "Fuzzy")
("gopls.staticcheck" t t)
("gopls.symbolMatcher" "Fuzzy"))))
(use-package go-dlv
:defer t)