aboutsummaryrefslogtreecommitdiff
path: root/.emacs.local.d/modes/lsp.el
diff options
context:
space:
mode:
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