dotfiles/emacs-lisp/lsp.org
Magic_RB e891fd2406
Emacs things
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2022-01-10 01:21:14 +01:00

1.5 KiB

LSP

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.

  (use-package lsp-python-ms
    :straight t
    :hook (python-mode . (lambda ()
                           (require 'lsp-python-ms)
                           (envrc-mode)
                           (setq-local lsp-python-ms-executable (executable-find "python-language-server"))
                           (lsp)))
    :config
    (defvar-local lsp-python-ms-executable ""))

C/C++

This just requires hooking lsp onto c-mode and c++-mode.

  (with-eval-after-load 'lsp
    (add-hook c-mode-hook #'lsp)
    (add-hook c++-mode-hook #'lsp))

Haskell

Enable haskell-mode, and lsp-haskell

    (use-package haskell-mode
      :straight t
      :hook ((haskell-mode haskell-literate-mode) . #'lsp)
      :hook ((haskell-mode haskell-literate-mode) . interactive-haskell-mode))
    (use-package lsp-haskell
      :straight t)

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.

  (with-eval-after-load "flycheck"
    (add-to-list 'flycheck-disabled-checkers 'haskell-stack-ghc))