diff --git a/emacs-lisp/lsp.org b/emacs-lisp/lsp.org new file mode 100644 index 0000000..612edd4 --- /dev/null +++ b/emacs-lisp/lsp.org @@ -0,0 +1,50 @@ +:PROPERTIES: +:ID: cc668372-8d95-461b-a7c6-3e2b51de3f40 +:END: +#+title: LSP +#+filetags: emacs-load + +* Python + +Using the Microsoft language server as it's the best afaik. It's weird because it doesn't lookup the path to itself via PATH but has to be statically set. + +#+BEGIN_SRC emacs-lisp + (use-package lsp-python-ms + :straight t + :hook (python-mode . (lambda () + (require 'lsp-python-ms) + (lsp))) + :init + (setq lsp-python-ms-executable (executable-find "python-language-server"))) +#+END_SRC + +* C/C++ + +This just requires hooking lsp onto ~c-mode~ and ~c++-mode~. + +#+BEGIN_SRC emacs-lisp + (with-eval-after-load 'lsp + (add-hook c-mode-hook #'lsp) + (add-hook c++-mode-hook #'lsp)) +#+END_SRC + +* Haskell + +Enable ~haskell-mode~, and ~lsp-haskell~ + +#+BEGIN_SRC emacs-lisp + (use-package haskell-mode + :straight t + :config + (add-hook 'haskell-mode-hook #'lsp) + (add-hook 'haskell-literate-mode-hook #'lsp)) + (use-package lsp-haskell + :straight t) +#+END_SRC + +Disable the ~haskell-stack-ghc~ flycheck checker, it's not used when lsp starts, but it does get loaded just before it. Loading and unloading it is slow and causes Emacs to freeze for a few seconds, so just disable it. + +#+BEGIN_SRC emacs-lisp + (with-eval-after-load "flycheck" + (add-to-list 'flycheck-disabled-checkers 'haskell-stack-ghc)) +#+END_SRC diff --git a/nix/home-manager/modules/emacs/.emacs.d/org/base.org b/nix/home-manager/modules/emacs/.emacs.d/org/base.org index ab77842..7044c55 100644 --- a/nix/home-manager/modules/emacs/.emacs.d/org/base.org +++ b/nix/home-manager/modules/emacs/.emacs.d/org/base.org @@ -221,17 +221,6 @@ Load =all-the-icons=, it's required used by =treemacs= and =doom-modeline=. You #+END_SRC * Language -** C/C++ - -Enable ~ccls~. - -#+BEGIN_SRC emacs-lisp - (use-package ccls - :straight t - :hook (c-mode . lsp) - (c++-mode . lsp)) -#+END_SRC - ** Nix Expression Language Enable ~nix-mode~. @@ -244,28 +233,6 @@ Enable ~nix-mode~. (add-hook 'nix-mode-hook #'lsp)) #+END_SRC -** Haskell Programming Language - -Enable ~haskell-mode~, and ~lsp-haskell~ - -#+BEGIN_SRC emacs-lisp - (use-package haskell-mode - :straight t - :config - (add-hook 'haskell-mode-hook #'lsp) - (add-hook 'haskell-literate-mode-hook #'lsp)) - (use-package lsp-haskell - :straight t) -#+END_SRC - -Disable the ~haskell-stack-ghc~ flycheck checker, it's not used when lsp starts, but it does get loaded just before -it. Loading and unloading it is slow and causes Emacs to freeze for a few seconds, so just disable it. - -#+BEGIN_SRC emacs-lisp - (with-eval-after-load "flycheck" - (add-to-list 'flycheck-disabled-checkers 'haskell-stack-ghc)) -#+END_SRC - ** HashiCorp *** HashiCorp Configuration Language @@ -369,33 +336,6 @@ but aside from minor indentation issues it works fine. :mode ("\\.tsx\\'" . typescript-mode) :hook (typescript-mode . lsp-mode)) #+END_SRC -** Scala Programming Language - -Enable ~scala-mode~ for =.scala=, =.sbt= and hook ~lsp-mode~ on it. - -#+BEGIN_SRC emacs-lisp - (use-package scala-mode - :straight t - :mode ("\\.s\\(cala\\|bt\\)$" . scala-mode) - :hook (scala-mode . lsp-mode)) -#+END_SRC - -Enable ~sbt-mode~, it's used for sbt buffers. - -#+BEGIN_SRC emacs-lisp - (use-package sbt-mode - :straight t - :commands sbt-start sbt-command - :config - ;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31 - ;; allows using SPACE when in the minibuffer - (substitute-key-definition - 'minibuffer-complete-word - 'self-insert-command - minibuffer-local-completion-map) - ;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152 - (setq sbt:program-options '("-Dsbt.supershell=false"))) -#+END_SRC ** Rust Programming Language Enable ~rustic~ and more feature-full alternative to ~rust-mode~, actually a rather distant fork of it.