aboutsummaryrefslogtreecommitdiff
path: root/.emacs.local.d/modes/lsp.el
diff options
context:
space:
mode:
authorRaul Benencia <raul@thousandeyes.com>2020-05-26 15:46:38 -0700
committerRaul Benencia <raul@thousandeyes.com>2020-05-26 15:46:38 -0700
commit65dea73b1362ba9ce03389e2148656bfba90d566 (patch)
treef95bb0f65d7160a2bee24fc18d682e3fd1fdf735 /.emacs.local.d/modes/lsp.el
parent38f4e04a6aea11231d14de45774fa158dae3ff1d (diff)
lsp in go
Diffstat (limited to '.emacs.local.d/modes/lsp.el')
-rw-r--r--.emacs.local.d/modes/lsp.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/.emacs.local.d/modes/lsp.el b/.emacs.local.d/modes/lsp.el
new file mode 100644
index 0000000..30a5d8f
--- /dev/null
+++ b/.emacs.local.d/modes/lsp.el
@@ -0,0 +1,19 @@
+(use-package lsp-mode
+ :ensure t
+ :commands (lsp lsp-deferred)
+ :hook (go-mode . lsp-deferred))
+
+;;Set up before-save hooks to format buffer and add/delete imports.
+;;Make sure you don't have other gofmt/goimports hooks enabled.
+
+(defun lsp-go-install-save-hooks ()
+ (add-hook 'before-save-hook #'lsp-format-buffer t t)
+ (add-hook 'before-save-hook #'lsp-organize-imports t t))
+(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
+
+;;Optional - provides fancier overlays.
+(use-package lsp-ui
+ :ensure t
+ :commands lsp-ui-mode
+ :init
+)
nihil fit ex nihilo