dotfiles/private_dot_emacs.d/org/lsp-and-ide.org

3.7 KiB

LSP and IDE setup

Languages

YAML

  (use-package yaml-mode
:ensure t
:mode ("\\.yml\\'" . yaml-mode)
:mode ("\\.yaml\\'" . yaml-mode))

Dockerfile

  (use-package dockerfile-mode
:ensure t
:mode ("Dockerfile\\'" . dockerfile-mode))

Rust

  (use-package rustic
:ensure t
:mode ("\\.rs\\'" . rustic-mode))

SCAD

  (use-package scad-mode
:ensure t)

Scala

  (use-package scala-mode
:ensure t
:mode ("\\.s\\(cala\\|bt\\)$" . scala-mode))

  (use-package sbt-mode
:ensure 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")))

Web - HTML + CSS

  (use-package web-mode
:ensure t
:mode ("\\.html\\'" . web-mode)
:mode ("\\.xhtml\\'" . web-mode)
:mode ("\\.css\\'" . css-mode)
:mode ("\\.scss\\'" . css-mode)
:config
(with-eval-after-load "flycheck"
(flycheck-add-mode 'javascript-eslint 'web-mode)))

Javascript

  (use-package rjsx-mode
:ensure t
:config
:mode ("\\.js\\'" . rjsx-mode)
:mode ("\\.jsx\\'" . rjsx-mode))

Typescript

  (use-package typescript-mode
:ensure t
:config
:mode ("\\.ts\\'" . typescript-mode)
:mode ("\\.tsx\\'" . typescript-mode))

LSP

lsp-mode

  (use-package lsp-mode
:ensure t
:after (; rustic
rjsx-mode
typescript-mode
web-mode
scala-mode)
:config
(setq rustic-lsp-server 'rust-analyzer)
(setq rustic-compile-command "cargo build")
(setq rustic-format-trigger nil);'on-save)
(setq lsp-prefer-flymake nil)
:hook
(rustic . lsp)
(php-mode . lsp)
(rjsx-mode . lsp)
(css-mode . lsp)
(web-mode . lsp)
(lsp-mode . lsp-lens-mode)
(typescript-mode . lsp)
(scala-mode . lsp)
(tex-mode . lsp)
(lsp-mode . display-fill-column-indicator-mode)
(python-mode . lsp)
(lsp-mode . origami-mode))

lsp-metals

  (use-package lsp-metals
:ensure t)

lsp-ui

  (use-package lsp-ui
:ensure t
:after (company-box)
:config
;; disable focus on mouse over
(push '(no-accept-focus . t) lsp-ui-doc-frame-parameters)
(push '(no-accept-focus . t) company-box-frame-parameters)

(add-to-list 'lsp-ui-doc-frame-parameters '(no-accept-focus . t))
(add-to-list 'company-box-frame-parameters '(no-accept-focus . t))
(setq mouse-autoselect-window nil))

lsp-pyright

  (use-package lsp-pyright
:ensure t
:hook (python-mode . (lambda ()
      (require 'lsp-pyright)
      (lsp))))  ; or lsp-deferred

yassnippet

  (use-package yasnippet
:ensure t
:config
(yas-global-mode 1))

flycheck

  (use-package flycheck
:ensure t
:init (global-flycheck-mode))