2021-11-07 23:09:13 +01:00
: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)
2021-11-08 21:59:16 +01:00
(envrc-mode)
(setq-local lsp-python-ms-executable (executable-find "python-language-server"))
2021-11-07 23:09:13 +01:00
(lsp)))
2021-11-08 21:59:16 +01:00
:config
(defvar-local lsp-python-ms-executable ""))
2021-11-07 23:09:13 +01:00
#+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
2022-01-18 00:26:49 +01:00
(use-package haskell-mode
:straight t
:hook ((haskell-mode haskell-literate-mode) . interactive-haskell-mode)
:config
(setq lsp-haskell-plugin-ghcide-type-lenses-global-on nil
lsp-haskell-plugin-import-lens-code-lens-on nil))
(use-package lsp-haskell
:straight t
:after lsp
:hook ((haskell-mode haskell-literate-mode) . #'lsp))
2021-11-07 23:09:13 +01:00
#+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