;; This should be used for any hooks instead of `lsp`. Doing so makes it so that ;; LSP will not be loaded automatically unless the file is already part of a ;; pre-configured workspace/project/session. There will be no automatic prompt when ;; a file is opened from a directory that is not part of an existing workspace. ;; To initialize a new workspace/project/session, use `M-x lsp`. (defun lsp-non-interactive () (require 'lsp) (when (lsp-workspace-root) (lsp))) (defun gered/enable-lsp () (interactive) (add-hook 'prog-mode-hook 'lsp-non-interactive) (message "Adding lsp hook to prog-modes")) (defun gered/disable-lsp () (interactive) (remove-hook 'prog-mode-hook 'lsp-non-interactive) (message "Removing lsp hook from prog-modes")) (use-package lsp-mode :ensure t :init (setq lsp-keymap-prefix "M-z") :hook ((prog-mode . lsp-non-interactive) (lsp-mode . lsp-enable-which-key-integration)) :config (setq lsp-enable-on-type-formatting nil) (setq lsp-headerline-breadcrumb-enable nil) (setq lsp-enable-snippet nil) (setq lsp-warn-no-matched-clients nil) ;; having this giant window pop-up while typing is mega annoying! wish this could be done ;; as a tooltip instead ... (setq lsp-signature-render-documentation nil) ;; seems to remove the semi-annoying "Unable to autoconfigure company-mode" warning ;; but still leaves completion via corfu working? (setq lsp-completion-provider :none) :commands lsp) (use-package lsp-ui :ensure t :commands lsp-ui) (use-package lsp-treemacs :ensure t :after lsp-mode :commands lsp-treemacs-errors-list)