;; LSP mode (use-package lsp-mode :config (lsp-register-custom-settings '(("gopls.completeUnimported" t t) ("gopls.staticcheck" t t) ("pyls.plugins.pyls_mypy.enabled" t t) ("pyls.plugins.pyls_mypy.live_mode" nil t) ("pyls.plugins.pyls_black.enabled" t t) ("pyls.plugins.pyls_isort.enabled" t t))) ;; disable infantile nonsense (setq lsp-headerline-breadcrumb-enable t lsp-modeline-code-actions-enable nil) ;; (lsp-enable-which-key-integration t) :bind ("C-c n". #'lsp-rename) ;; I am using lsp-ui for this, see below ;; ("C-c r" . #'lsp-find-references) ; default: C-c C-l g r ;; ("C-c d" . #'lsp-find-definition) ; default: C-c C-l g g ;; ;; same as above, but directly within prefix, not 'g neede ;; ("C-c C-l r" . #'lsp-find-references) ; default: C-c C-l g r ;; ("C-c C-l d" . #'lsp-find-definition) ; default: C-c C-l g g :init ;; I'm not using any of th lsp commands, but better define a prefix ;; than being unable to reach it ;; FIXME: add at least lsp-find-definition (setq lsp-keymap-prefix "C-c C-l" lsp-log-io nil lsp-enable-indentation t lsp-enable-imenu t lsp-file-watch-threshold 500 lsp-prefer-flymake nil) :commands lsp) ;; for lsp code lenses etc ;; https://emacs-lsp.github.io/lsp-ui/ ;; FIXME: ⛔ Error (use-package): Failed to install lsp-ui: https://melpa.org/packages/lsp-ui-20250804.2109.tar: Not found ;; manually installed using package-install (use-package lsp-ui :ensure t :after (lsp-mode) :commands lsp-ui-doc-hide :bind (:map lsp-ui-mode-map ("C-c d" . #'lsp-ui-peek-find-definitions) ("C-c r" . #'lsp-ui-peek-find-references) ([remap xref-find-definitions] . lsp-ui-peek-find-definitions) ([remap xref-find-references] . lsp-ui-peek-find-references) ;;; ("C-c u" . lsp-ui-imenu) ;; using treemacs for this ("C-c D" . tvd-lsp-doc-toggle)) :init (setq lsp-ui-doc-enable nil ;; enable on the fly with "C-c D" lsp-ui-doc-use-webkit nil lsp-ui-doc-header t lsp-ui-doc-delay 0.2 lsp-ui-doc-position 'top lsp-ui-doc-side 'right lsp-ui-doc-include-signature t lsp-ui-doc-alignment 'at-point lsp-ui-doc-use-childframe t lsp-ui-doc-border (face-foreground 'default) ;; C-c r lsp-ui-peek-enable t lsp-ui-peek-show-directory t lsp-ui-peek-peek-height 40 ;; FIXME: maybe this is too much, check at work lsp-ui-sideline-enable t lsp-ui-sideline-update-mode 'point lsp-ui-sideline-show-code-actions nil lsp-ui-sideline-show-hover t lsp-ui-sideline-delay 2 lsp-ui-sideline-show-diagnostics nil lsp-ui-sideline-diagnostic-max-lines t lsp-ui-sideline-ignore-duplicate t) :config (add-to-list 'lsp-ui-doc-frame-parameters '(right-fringe . 8)) (defun tvd-lsp-doc-toggle() "Toggle lsp-ui-doc, takes effect only on buffer start. So in order to change in a buffer, reload the buffer after the toggle with shift-F5." (interactive) (setq lsp-ui-doc-enable (not lsp-ui-doc-enable)) (tvd-buffer-reload)) ;; `C-g'to close doc (advice-add #'keyboard-quit :before #'lsp-ui-doc-hide)) ;; better recursive refs, symbols, etc ;; see also https://github.com/Alexander-Miller/treemacs (use-package lsp-treemacs :after lsp :bind ("C-c u" . #'lsp-treemacs-symbols) ("C-c C-l c" . #'lsp-treemacs-call-hierarchy)) (use-package treemacs :bind ("C-c t" . #'treemacs) :init (setq treemacs-project-follow-mode t treemacs-extra-wide-toggle t treemacs-follow-mode t)) (provide 'init-lsp) ;;; init-lsp.el ends here