diff options
author | Franck Cuny <franck.cuny@gmail.com> | 2020-01-13 14:15:31 -0800 |
---|---|---|
committer | Franck Cuny <franck.cuny@gmail.com> | 2020-01-13 14:15:31 -0800 |
commit | b5dd649f07998b289e90862d74d6fb8e046345a8 (patch) | |
tree | 33db6640420e3e55b6115723a032248b3782e0cc /emacs | |
parent | emacs/text: flyspell configuration. (diff) | |
download | emacs.d-b5dd649f07998b289e90862d74d6fb8e046345a8.tar.gz |
emacs/prog: more cleanup for lsp/go.
A few changes to the configuration related to go, mostly to drop some code that is not needed anymore. Add a few more bindings for LSP. Add `company-posframe`, which is a nicer UI for company.
Diffstat (limited to '')
-rw-r--r-- | emacs.d/custom/fcuny-go.el | 27 | ||||
-rw-r--r-- | emacs.d/custom/fcuny-prog.el | 22 |
2 files changed, 28 insertions, 21 deletions
diff --git a/emacs.d/custom/fcuny-go.el b/emacs.d/custom/fcuny-go.el index 032f794..d925cf6 100644 --- a/emacs.d/custom/fcuny-go.el +++ b/emacs.d/custom/fcuny-go.el @@ -1,23 +1,16 @@ +(defun fcuny/go-mode-setup () + (setq tab-width 4) + (setq comment-auto-fill-only-comments t) + (setq fill-column 80) + (auto-fill-mode 1)) + (use-package go-mode :ensure t - :after (exec-path-from-shell flycheck flyspell company company-go hydra) + :after (exec-path-from-shell flycheck flyspell company hydra) :hook ((go-mode . fcuny/go-mode-setup) - (go-mode . company-mode)) - :custom - (godoc-use-completing-read t) - (gofmt-command "goimports") - - ;; see https://github.com/dominikh/go-mode.el/issues/262 - (godoc-at-point-function 'godoc-gogetdoc) - - :init - (defun fcuny/go-mode-setup () - (setq tab-width 4) - (setq comment-auto-fill-only-comments t) - (setq fill-column 80) - (auto-fill-mode 1) - (add-hook 'before-save-hook 'gofmt-before-save)) - + (go-mode . lsp-deferred) + (before-save . lsp-format-buffer) + (before-save . lsp-organize-imports)) :config (when (memq window-system '(mac ns)) (exec-path-from-shell-copy-env "GOPATH"))) diff --git a/emacs.d/custom/fcuny-prog.el b/emacs.d/custom/fcuny-prog.el index 92dd9c7..b895807 100644 --- a/emacs.d/custom/fcuny-prog.el +++ b/emacs.d/custom/fcuny-prog.el @@ -3,17 +3,27 @@ (use-package company :ensure t :diminish company-mode - :custom (company-minimum-prefix-length 2) (company-tooltip-align-annotations t) (company-tooltip-limit 12) (company-idle-delay 1)) +(use-package company-posframe + :ensure t + :diminish company-posframe-mode + :hook (company-mode . company-posframe-mode) + :after company) + (use-package lsp-mode :ensure t :commands (lsp lsp-deferred) - :hook (go-mode . lsp-deferred) + :bind (:map lsp-mode-map + ("C-c e b" . lsp-format-buffer) + ("C-c e m" . lsp-ui-imenu) + ("C-c e r" . lsp-rename) + ("C-c e p" . lsp-ui-peek-find-references) + ("C-c e t" . lsp-find-type-definition)) :custom (lsp-session-file (expand-file-name "lsp-session-v1" fcuny/path-emacs-var)) (lsp-enable-snippet nil) @@ -23,7 +33,8 @@ :ensure t :commands lsp-ui-mode :custom - (lsp-ui-doc-enable t) + (lsp-ui-doc-enable nil) + (lsp-ui-doc-include-signature t) (lsp-ui-peek-enable t) (lsp-ui-sideline-enable t) (lsp-ui-imenu-enable t) @@ -34,6 +45,9 @@ :after company :commands company-lsp :config - (push 'company-lsp company-backends)) + (push 'company-lsp company-backends) + :custom + (company-lsp-enable-snippet t) + (company-lsp-cache-candidates t)) (provide 'fcuny-prog) |