From 2bbed5ec8c46b37a8fe49b211601e42dc9a5f366 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 16 Feb 2019 13:01:50 -0500 Subject: [PATCH] Set up a bunch of LSP stuff --- emacs/init.org | 51 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index af2982a..e2a1276 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -969,10 +969,13 @@ Use nvm to manage node versions: #+BEGIN_SRC emacs-lisp (use-package web-mode) #+END_SRC -* Java -LSP Java uses the Eclipse JDT Language Server as a backend to enable Java IDE features. +* LSP Mode +Emacs support for the Language Server Protocol + #+BEGIN_SRC emacs-lisp - (use-package lsp-mode) + (use-package lsp-mode + :config + (leader-def-key "cd" #'xref-find-definitions)) (use-package company-lsp :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-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 () (lsp-java-enable) (flycheck-mode t) @@ -1012,11 +1022,15 @@ Configure Java project sources: #+END_SRC * Python +#+BEGIN_SRC emacs-lisp + (add-hook 'python-mode-hook #'lsp) +#+END_SRC + Elpy is a python IDE package: #+BEGIN_SRC emacs-lisp (use-package elpy :config - (elpy-enable) +; (elpy-enable) (pyvenv-mode) (leader-def-key "sp" #'elpy-shell-switch-to-shell)) @@ -1055,16 +1069,9 @@ Basic support: :mode (("\\.go\\'" . go-mode))) #+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 - (use-package company-go - :after go-mode - :config - (add-hook 'go-mode-hook - (lambda () - (set (make-local-variable 'company-backends) '(company-go)) - (company-mode-on)))) - + (add-hook 'go-mode-hook #'lsp) #+END_SRC * 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 $*"))) #+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 - (use-package company-php - :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)))) - + (add-hook 'php-mode-hook #'lsp) #+END_SRC * Pharen @@ -1209,6 +1209,13 @@ Company-mode autocompletion for PHP: (add-to-list 'auto-mode-alist '("\\.phn\\'" . clojure-mode)) #+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 #+BEGIN_SRC emacs-lisp (use-package csv-mode