Improvements for LSP mode

This commit is contained in:
Wojciech Kozlowski 2021-08-23 23:45:51 +02:00
parent 86a951effa
commit 79719eeb2b
4 changed files with 26 additions and 16 deletions

View File

@ -153,7 +153,13 @@
(add-hook 'minibuffer-setup-hook (lambda () (setq gc-cons-threshold most-positive-fixnum))) (add-hook 'minibuffer-setup-hook (lambda () (setq gc-cons-threshold most-positive-fixnum)))
(add-hook 'minibuffer-exit-hook (lambda () (setq gc-cons-threshold 800000))) (add-hook 'minibuffer-exit-hook (lambda () (setq gc-cons-threshold 100000000)))
;; -----------------------------------------------------------------------------------------------
;; Increase the amount of data which Emacs reads from the process.
;; -----------------------------------------------------------------------------------------------
(setq read-process-output-max (* 1024 1024)) ;; 1 MB
;; ----------------------------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; Additional key-bindings. ;; Additional key-bindings.

View File

@ -134,7 +134,9 @@
;; ----------------------------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
(use-package helm-lsp (use-package helm-lsp
:after (helm lsp-mode)) :after (helm lsp-mode)
:config
(define-key lsp-mode-map [remap xref-find-apropos] #'helm-lsp-workspace-symbol))
;; --------------------------------------------------------------------------------------------- ;; ---------------------------------------------------------------------------------------------
;; `helm-projectile' ;; `helm-projectile'

View File

@ -34,8 +34,9 @@
;; Protobuf ;; Protobuf
protobuf-mode protobuf-mode
;; Python ;; Python
pyvenv
cython-mode cython-mode
lsp-pyright
pyvenv
py-autopep8 py-autopep8
;; Rust ;; Rust
cargo cargo
@ -159,9 +160,14 @@
(make-local-variable 'lsp-enable-snippet) (make-local-variable 'lsp-enable-snippet)
(setq lsp-enable-snippet nil)) (setq lsp-enable-snippet nil))
:hook :hook
(python-mode . lsp) (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp)))
(python-mode . x-lsp-disable-snippet)) (python-mode . x-lsp-disable-snippet))
(use-package lsp-pyright
:defer t)
(use-package py-autopep8 (use-package py-autopep8
;; Note that this package require autopep8 to be installed. ;; Note that this package require autopep8 to be installed.
:bind (("C-c C-f" . py-autopep8-buffer))) :bind (("C-c C-f" . py-autopep8-buffer)))

View File

@ -179,12 +179,12 @@
("C-p" . company-select-previous)) ("C-p" . company-select-previous))
:config :config
(setq company-idle-delay 0 (setq company-idle-delay 0
company-minimum-prefix-length 3 company-minimum-prefix-length 1
company-tooltip-align-annotations t) company-tooltip-align-annotations t)
;; For this to correctly complete headers, need to add all include paths to ;; For this to correctly complete headers, need to add all include paths to
;; `company-c-headers-path-system'. ;; `company-c-headers-path-system'.
(add-to-list 'company-backends 'company-c-headers) (add-to-list 'company-backends 'company-c-headers)
(setq company-backends (delete 'company-clang company-backends)) ;; (setq company-backends (delete 'company-clang company-backends))
(setq company-backends (delete 'company-dabbrev company-backends)) (setq company-backends (delete 'company-dabbrev company-backends))
(setq company-backends (delete 'company-capf company-backends))) (setq company-backends (delete 'company-capf company-backends)))
@ -294,21 +294,17 @@
:commands lsp :commands lsp
:init :init
(setq lsp-diagnostics-provider :flycheck (setq lsp-diagnostics-provider :flycheck
lsp-signature-auto-activate t
lsp-signature-doc-lines 1
lsp-enable-indentation nil lsp-enable-indentation nil
lsp-file-watch-threshold 10000)) lsp-file-watch-threshold 25000)
:hook ((lsp-mode . lsp-enable-which-key-integration)))
(use-package lsp-ui (use-package lsp-ui
:commands lsp-ui-mode :commands lsp-ui-mode
:init :bind
(setq lsp-ui-doc-enable nil (("M-#" . lsp-ui-doc-focus-frame))
lsp-ui-sideline-enable nil)
:config :config
(define-key lsp-ui-mode-map (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
[remap xref-find-definitions] #'lsp-ui-peek-find-definitions) (define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references))
(define-key lsp-ui-mode-map
[remap xref-find-references] #'lsp-ui-peek-find-references))
;; ----------------------------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------------------------
;; `semantic' ;; `semantic'