From 90be8edc2d405825f4aeae3ab8d84e20f1daa1a4 Mon Sep 17 00:00:00 2001 From: Levi Date: Wed, 4 Sep 2024 17:01:21 +0200 Subject: [PATCH] lsp --- emacs/custom.el | 2 +- emacs/init.el | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/emacs/custom.el b/emacs/custom.el index 4ad3d83..b2fc314 100644 --- a/emacs/custom.el +++ b/emacs/custom.el @@ -9,7 +9,7 @@ '("9c22d1654fbfed0285a519541b5ea76462d9b03d778d1dc34779fd38613bf7c8" "9fb561389e5ac5b9ead13a24fb4c2a3544910f67f12cfcfe77b75f36248017d0" "88f7ee5594021c60a4a6a1c275614103de8c1435d6d08cc58882f920e0cec65e" "aec7b55f2a13307a55517fdf08438863d694550565dee23181d2ebd973ebd6b8" "014cb63097fc7dbda3edf53eb09802237961cbb4c9e9abd705f23b86511b0a69" "81f53ee9ddd3f8559f94c127c9327d578e264c574cda7c6d9daddaec226f87bb" "3770d0ae70172461ee0a02edcff71b7d480dc54066e8960d8de9367d12171efb" "f64189544da6f16bab285747d04a92bd57c7e7813d8c24c30f382f087d460a33" "f079ef5189f9738cf5a2b4507bcaf83138ad22d9c9e32a537d61c9aae25502ef" "835d934a930142d408a50b27ed371ba3a9c5a30286297743b0d488e94b225c5f" default)) '(elfeed-feeds '("https://hnrss.org/newest")) '(package-selected-packages - '(plan9-theme parchment-theme acme-theme wrap-region surround go-playground dired-sidebar consult persistent-scratch scratch cape kind-icon corfu eat eshell-toggle eshell-git-prompt eshell-bookmark eshell-autojump eshell-atuin elfeed vertico orderless plz ace-mc ace-jump-mode flycheck fic-mode kotlin-mode rego-mode protobuf-mode multi-web-mode mmm-mode python-mode php-mode json-mode yaml-mode go-mode plantuml-mode graphviz-dot-mode magit denote unicode-fonts nerd-icons-ibuffer nerd-icons-completion nerd-icons-dired doom-modeline which-key multiple-cursors dash async-status async consult-projectile)) + '(cmus plan9-theme parchment-theme acme-theme wrap-region surround go-playground dired-sidebar consult persistent-scratch scratch cape kind-icon corfu eat eshell-toggle eshell-git-prompt eshell-bookmark eshell-autojump eshell-atuin elfeed vertico orderless plz ace-mc ace-jump-mode flycheck fic-mode kotlin-mode rego-mode protobuf-mode multi-web-mode mmm-mode python-mode php-mode json-mode yaml-mode go-mode plantuml-mode graphviz-dot-mode magit denote unicode-fonts nerd-icons-ibuffer nerd-icons-completion nerd-icons-dired doom-modeline which-key multiple-cursors dash async-status async consult-projectile)) '(tab-width 2)) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/emacs/init.el b/emacs/init.el index 35fd42b..b14bf7d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -184,6 +184,19 @@ (global-set-key (kbd "C-x E n r") #'narrow-to-region) (global-set-key (kbd "C-x E w") #'widen) + (with-eval-after-load 'lsp-mode + (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration) + ;; (setq lsp-idle-delay 0.500) + ;; (setq lsp-log-io nil) + ;; (setq lsp-completion-provider :capf) + (add-hook 'prog-mode-hook 'lsp-deferred) + (add-hook 'before-save-hook #'lsp-format-buffer) + + (setq lsp-file-watch-threshold nil) + (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]plz-out\\'")) + + + (when (file-exists-p custom-file) (load custom-file))) @@ -365,7 +378,7 @@ (setq eglot-completion-style 'orderless) (setq eglot-completion-provider :company) (with-eval-after-load 'orderless - (setq orderless-matching-styles '(orderless-flex orderless-regexp orderless-initialism))) + (setq orderless-matching-styles '(orderless-literal orderless-regexp orderless-initialism orderless-flex))) :bind (:map eglot-mode-map ("s-l a" . eglot-code-actions) ("s-l r" . eglot-rename) @@ -651,3 +664,26 @@ ) (define-key dired-mode-map (kbd "C-c d") 'my/dired-duplicate-file) + + +(use-package lsp-mode :ensure t + :commands lsp + :custom + (lsp-completion-provider :none) ;; we use Corfu! + :init + (defun my/lsp-mode-setup-completion () + (lsp-enable-which-key-integration) + (setf + (alist-get 'styles + (alist-get 'lsp-capf completion-category-defaults)) + '(orderless))) + :config + (setq lsp-prefer-flymake nil) + :hook + (lsp-completion-mode . my/lsp-mode-setup-completion)) + + +(add-to-list 'auto-mode-alist '("BUILD\\'" . python-mode)) +;; Less chatty for unsupported modes +(setq lsp-warn-no-matched-clients nil) +(setq lsp-file-watch-threshold nil)