Set up a bunch of LSP stuff

This commit is contained in:
Jeremy Dormitzer 2019-02-16 13:01:50 -05:00
parent fb5c087ea7
commit 2bbed5ec8c

View File

@ -969,10 +969,13 @@ Use nvm to manage node versions:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package web-mode) (use-package web-mode)
#+END_SRC #+END_SRC
* Java * LSP Mode
LSP Java uses the Eclipse JDT Language Server as a backend to enable Java IDE features. Emacs support for the Language Server Protocol
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package lsp-mode) (use-package lsp-mode
:config
(leader-def-key "cd" #'xref-find-definitions))
(use-package company-lsp (use-package company-lsp
:after (company) :after (company)
@ -986,6 +989,13 @@ LSP Java uses the Eclipse JDT Language Server as a backend to enable Java IDE fe
lsp-ui-sideline-show-code-actions t lsp-ui-sideline-show-code-actions t
lsp-ui-sideline-update-mode 'point)) lsp-ui-sideline-update-mode 'point))
(use-package dap-mode
:after (lsp-mode))
#+END_SRC
* Java
LSP Java uses the Eclipse JDT Language Server as a backend to enable Java IDE features.
#+BEGIN_SRC emacs-lisp
(defun jdormit/set-up-java () (defun jdormit/set-up-java ()
(lsp-java-enable) (lsp-java-enable)
(flycheck-mode t) (flycheck-mode t)
@ -1012,11 +1022,15 @@ Configure Java project sources:
#+END_SRC #+END_SRC
* Python * Python
#+BEGIN_SRC emacs-lisp
(add-hook 'python-mode-hook #'lsp)
#+END_SRC
Elpy is a python IDE package: Elpy is a python IDE package:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package elpy (use-package elpy
:config :config
(elpy-enable) ; (elpy-enable)
(pyvenv-mode) (pyvenv-mode)
(leader-def-key "sp" #'elpy-shell-switch-to-shell)) (leader-def-key "sp" #'elpy-shell-switch-to-shell))
@ -1055,16 +1069,9 @@ Basic support:
:mode (("\\.go\\'" . go-mode))) :mode (("\\.go\\'" . go-mode)))
#+END_SRC #+END_SRC
Add in autocompletion. This requires [[https://github.com/mdempsky/gocode][gocode]] to be installed: LSP support - requires [[https://github.com/sourcegraph/go-langserver][go-langserver]].
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package company-go (add-hook 'go-mode-hook #'lsp)
:after go-mode
:config
(add-hook 'go-mode-hook
(lambda ()
(set (make-local-variable 'company-backends) '(company-go))
(company-mode-on))))
#+END_SRC #+END_SRC
* Clojure * Clojure
@ -1191,16 +1198,9 @@ An Eshell alias to start PHP using XDebug:
"php -d xdebug.remote_enable=on -d xdebug.remote_host=127.0.0.1 -d xdebug.remote_port=9000 -d xdebug.remote_handler=dbgp -d xdebug.idekey=geben -d xdebug.remote_autostart=On $*"))) "php -d xdebug.remote_enable=on -d xdebug.remote_host=127.0.0.1 -d xdebug.remote_port=9000 -d xdebug.remote_handler=dbgp -d xdebug.idekey=geben -d xdebug.remote_autostart=On $*")))
#+END_SRC #+END_SRC
Company-mode autocompletion for PHP: LSP for PHP requires [[https://github.com/felixfbecker/php-language-server][php-language-server]] to be installed in ~/.composer:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package company-php (add-hook 'php-mode-hook #'lsp)
:config
(add-hook 'php-mode-hook
(lambda ()
(ac-php-core-eldoc-setup)
(make-local-variable 'company-backends)
(add-to-list 'company-backends 'company-ac-php-backend))))
#+END_SRC #+END_SRC
* Pharen * Pharen
@ -1209,6 +1209,13 @@ Company-mode autocompletion for PHP:
(add-to-list 'auto-mode-alist '("\\.phn\\'" . clojure-mode)) (add-to-list 'auto-mode-alist '("\\.phn\\'" . clojure-mode))
#+END_SRC #+END_SRC
* Bash
Use LSP if [[https://github.com/mads-hartmann/bash-language-server][bash-language-server]] is installed.
#+BEGIN_SRC emacs-lisp
(when (executable-find "bash-language-server")
(add-hook 'sh-mode-hook #'lsp))
#+END_SRC
* CSVs * CSVs
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package csv-mode (use-package csv-mode