now to import / initialize a new lsp workspace/project, a file needs to be opened from the workspace/project directory, and `M-x lsp` needs to be manually run, which will trigger the project import prompt existing lsp workspaces/projects will still open automatically, triggering the lsp to load for them, etc.
62 lines
1.7 KiB
EmacsLisp
62 lines
1.7 KiB
EmacsLisp
(use-package emacs
|
|
:ensure nil
|
|
:hook ((prog-mode . electric-pair-mode)))
|
|
|
|
;; (use-package idle-highlight-mode
|
|
;; :ensure t
|
|
;; :hook ((prog-mode . idle-highlight-mode)))
|
|
|
|
(use-package treesit-auto
|
|
:ensure t
|
|
:custom
|
|
(treesit-auto-install 'prompt)
|
|
:config
|
|
(treesit-auto-add-to-auto-mode-alist 'all)
|
|
(global-treesit-auto-mode))
|
|
|
|
;; 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)
|
|
;; 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)
|