From 7c6aad950df2dda6ac34fedcfc700d9eb2009ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Alvari=C3=B1o?= Date: Mon, 21 Mar 2022 11:48:09 +0100 Subject: [PATCH] Add first LSP try --- myconfig.org | 106 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 6 deletions(-) diff --git a/myconfig.org b/myconfig.org index bad5889..2eabaeb 100644 --- a/myconfig.org +++ b/myconfig.org @@ -20,7 +20,7 @@ This file: - Loads the newer of this two files: =myconfig.org= and =myconfig.el=. In other words, if there are no new changes in =myconfig.org= it loads =myconfig.el= (it's faster) * use-package tips - Some notes about *use-package* + Some notes about [[https://github.com/jwiegley/use-package][use-package]] - *:ensure* if true will install the package if not installed It won't update packages. See auto-package-update for keeping all packages up to date @@ -32,10 +32,11 @@ This file: occurs - *:custom* permite configurar variables con syntaxis simplificada - *:bind* - - *bind-keymap* + - *:bind-keymap* + - *:commands* - *:mode* and *:interpreter* - *:magic* - - *:hook* + - *:hook* You can define hooks - *:if* - *:defer* En general use-package intenta aplicar lazy loading, pero en algún paquete es necesario especificarlo explicitamente @@ -490,8 +491,9 @@ Quick navigation to words * Project management with projectile #+begin_src emacs-lisp (use-package projectile - :config + :init (projectile-global-mode) + :config (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) ) #+end_src @@ -626,12 +628,104 @@ Links to check - [[https://github.com/pythonic-emacs/pyenv-mode][pyenv-mode]] - [[https://www.mortens.dev/blog/emacs-and-the-language-server-protocol/][Morten's Dev]] (tiene buena pinta) - [[https://mullikine.github.io/posts/setting-up-lsp-with-emacs-attempt-2/][Bodacious Blog]] (parece muy completo pero algo criptico) +- [[https://gitlab.com/nathanfurnal/dotemacs/-/snippets/2060535][Nathan Furnal Guide]] LSP mode, allows the use of Language Server Protocol for programming. **lsp-keymap prefix remapped to "C-c l"** +#+begin_src emacs-lisp + (use-package lsp-mode + :init + (setq lsp-keymap-prefix "C-c l") + + :commands + (lsp lsp-deferred lsp-execute-code-action) + + :custom + ;; debug + ;; set these variables for debugging lsp-mode + (lsp-print-io t) + (lsp-trace t) + (lsp-print-performance t) + + ;; general + ;; (lsp-auto-guess-root t) + ;; (lsp-document-sync-method 'incremental) ;; none, full, incremental, or nil + ;; (lsp-response-timeout 10) + + ;; let's use flycheck + (lsp-prefer-flymake nil) ;; t(flymake), nil(lsp-ui), or :none + + ;; (company-lsp-cache-candidates t) ;; auto, ;TODO: (always using a cache), or nil + ;; (company-lsp-async t) + ;; (company-lsp-enable-recompletion t) + ;; (company-lsp-enable-snippet t) + ;; (lsp-document-sync-method (quote incremental)) + + ;; :hook + ;; ((python-mode . lsp-deferred) + ;; (lsp-mode . lsp-enable-which-key-integration) + ;; (lsp-mode . lsp-diagnostics-modeline-mode)) + ;; :bind + ;; ("C-c C-c" . #'lsp-execute-code-action) + ;; :custom + ;; (lsp-diagnostics-modeline-scope :project) + ;; (lsp-file-watch-threshold 5000) + ;; (lsp-enable-file-watchers nil) + ;; ;(lsp-enable-which-key-integration t) + ) +#+end_src + +** lsp-ui +- [[https://emacs-lsp.github.io/lsp-ui/][lsp-ui]] + +#+begin_src emacs-lisp + (use-package lsp-ui + :custom + (lsp-ui-doc-delay 0.75) + (lsp-ui-doc-max-height 200) + + ;; (lsp-ui-doc-enable t) + ;; (lsp-ui-doc-header t) + ;; (lsp-ui-doc-include-signature t) + ;; (lsp-ui-doc-max-height 30) + ;; (lsp-ui-doc-max-width 120) + ;; (lsp-ui-doc-position (quote at-point)) + ;; (lsp-ui-doc-use-childframe t) + ;; + ;; ;; If this is true then you can't see the docs in terminal + ;; (lsp-ui-doc-use-webkit nil) + ;; (lsp-ui-flycheck-enable t) + ;; + ;; (lsp-ui-imenu-enable t) + ;; (lsp-ui-imenu-kind-position (quote top)) + ;; (lsp-ui-peek-enable t) + ;; + ;; (lsp-ui-peek-fontify 'on-demand) ;; never, on-demand, or always + ;; (lsp-ui-peek-list-width 50) + ;; (lsp-ui-peek-peek-height 20) + ;; (lsp-ui-sideline-code-actions-prefix "" t) + ;; + ;; ;inline right flush docs + ;; (lsp-ui-sideline-enable t) + ;; (lsp-ui-sideline-ignore-duplicate t) + ;; (lsp-ui-sideline-show-code-actions t) + ;; (lsp-ui-sideline-show-diagnostics t) + ;; (lsp-ui-sideline-show-hover t) + ;; (lsp-ui-sideline-show-symbol t) + + + + :after lsp-mode) +#+end_src + +** go +#+begin_src emacs-lisp +;; '(lsp-clients-go-server-args '("--cache-style=always" "--diagnostics-style=onsave" "--format-style=goimports")) --> +#+end_src * next - #+begin_src emacs-lisp - #+end_src +#+begin_src emacs-lisp + +#+end_src