parent
ae5cb5b957
commit
2849efdf2e
3 changed files with 44 additions and 36 deletions
|
@ -39,19 +39,28 @@ This module has no dedicated maintainers.
|
||||||
|
|
||||||
* Prerequisites
|
* Prerequisites
|
||||||
** Language Server Protocol servers
|
** Language Server Protocol servers
|
||||||
Currently the servers supported depend on the =:tools lsp= flavor you are using
|
LSP server support depends on which flavor of the =:tools lsp= module you have
|
||||||
|
installed (Eglot or LSP-mode).
|
||||||
|
|
||||||
*** LSP-mode
|
*** LSP-mode
|
||||||
This server is built in Java, so a ~java~ environment will be necessary
|
Three servers are supported, ordered from highest to lowest priority:
|
||||||
+ [[https://github.com/EmmyLua/EmmyLua-LanguageServer][EmmyLua-LanguageServer]] must be installed and configured to use the
|
|
||||||
configuration provided by emacs-lsp.
|
+ [[https://github.com/EmmyLua/EmmyLua-LanguageServer][EmmyLua-LanguageServer]] :: Must be in =~/.emacs.d/.local/etc/lsp/EmmyLua-LS-all.jar=. See ~lsp-clients-emmy-lua-jar-path~ variable to change this.
|
||||||
|
+ [[https://github.com/sumneko/lua-language-server][Sumneko language server]] (lua-language-server) :: Must be in
|
||||||
|
=~/.config/emacs/.local/etc/lsp/lua-language-server/=. See
|
||||||
|
~lsp-clients-lua-language-server-bin~ variable to change this.
|
||||||
|
+ [[https://github.com/Alloyed/lua-lsp][lua-lsp]] :: Must be available in =~/.luarocks/bin/lua-lsp=. See
|
||||||
|
~lsp-clients-lua-lsp-server-install-dir~ variable to change this.
|
||||||
|
|
||||||
[[https://emacs-lsp.github.io/lsp-mode/page/lsp-emmy-lua/][LSP-mode documentation]] has more information about setting up the server and the
|
[[https://emacs-lsp.github.io/lsp-mode/page/lsp-emmy-lua/][LSP-mode documentation]] has more information about setting up the server and the
|
||||||
configuration variables correctly (use a bare ~(setq
|
configuration variables correctly.
|
||||||
lsp-clients-emmy-lua-java-path value)~ in your =config.el=)
|
|
||||||
*** Eglot
|
*** Eglot
|
||||||
This server is built in Lua, so a =lua= environment will be necessary
|
Eglot currently only supports one of the above servers out of the box:
|
||||||
+ [[https://github.com/sumneko/lua-language-server][lua-language-server]] must be installed and built locally, with =+lua-lsp-dir=
|
|
||||||
variable pointing to the root of the repository
|
+ [[https://github.com/sumneko/lua-language-server][Sumneko language server]] (lua-language-server) :: Must be in
|
||||||
|
=~/.config/emacs/.local/etc/lsp/lua-language-server/=. See
|
||||||
|
~+lua-lsp-dir~ variable to change this.
|
||||||
|
|
||||||
* TODO Features
|
* TODO Features
|
||||||
# An in-depth list of features, how to use them, and their dependencies.
|
# An in-depth list of features, how to use them, and their dependencies.
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
;;; lang/lua/config.el -*- lexical-binding: t; -*-
|
;;; lang/lua/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +lua-lsp-dir (concat doom-etc-dir "lsp/lua-language-server/")
|
|
||||||
"Absolute path to the directory of sumneko's lua-language-server.
|
|
||||||
|
|
||||||
This directory MUST contain the 'main.lua' file and be the in-source build of
|
|
||||||
lua-language-server.")
|
|
||||||
|
|
||||||
;; sp's default rules are obnoxious, so disable them
|
;; sp's default rules are obnoxious, so disable them
|
||||||
(provide 'smartparens-lua)
|
(provide 'smartparens-lua)
|
||||||
|
|
||||||
|
@ -25,27 +19,29 @@ lua-language-server.")
|
||||||
(set-company-backend! 'lua-mode '(company-lua company-yasnippet))
|
(set-company-backend! 'lua-mode '(company-lua company-yasnippet))
|
||||||
|
|
||||||
(when (featurep! +lsp)
|
(when (featurep! +lsp)
|
||||||
(defun +lua-generate-lsp-server-command ()
|
(add-hook 'lua-mode-local-vars-hook #'lsp!)
|
||||||
;; The absolute path to lua-language-server binary is necessary because
|
|
||||||
;; the bundled dependencies aren't found otherwise. The only reason this
|
|
||||||
;; is a function is to dynamically change when/if `+lua-lsp-dir' does
|
|
||||||
(list (doom-path +lua-lsp-dir
|
|
||||||
(cond (IS-MAC "bin/macOS")
|
|
||||||
(IS-LINUX "bin/Linux")
|
|
||||||
(IS-WINDOWS "bin/Windows"))
|
|
||||||
"lua-language-server")
|
|
||||||
"-E" "-e" "LANG=en"
|
|
||||||
(doom-path +lua-lsp-dir "main.lua")))
|
|
||||||
|
|
||||||
(if (featurep! :tools lsp +eglot)
|
(when (featurep! :tools lsp +eglot)
|
||||||
(set-eglot-client! 'lua-mode (+lua-generate-lsp-server-command))
|
(defvar +lua-lsp-dir (concat doom-etc-dir "lsp/lua-language-server/")
|
||||||
(after! lsp-mode
|
"Absolute path to the directory of sumneko's lua-language-server.
|
||||||
(lsp-register-client
|
|
||||||
(make-lsp-client :new-connection (lsp-stdio-connection '+lua-generate-lsp-server-command)
|
This directory MUST contain the 'main.lua' file and be the in-source build of
|
||||||
:major-modes '(lua-mode)
|
lua-language-server.")
|
||||||
:priority -1
|
|
||||||
:server-id 'lua-langserver))))
|
(defun +lua-generate-lsp-server-command ()
|
||||||
(add-hook 'lua-mode-local-vars-hook #'lsp!)))
|
;; The absolute path to lua-language-server binary is necessary because
|
||||||
|
;; the bundled dependencies aren't found otherwise. The only reason this
|
||||||
|
;; is a function is to dynamically change when/if `+lua-lsp-dir' does
|
||||||
|
(list (or (executable-find "lua-language-server")
|
||||||
|
(doom-path +lua-lsp-dir
|
||||||
|
(cond (IS-MAC "bin/macOS")
|
||||||
|
(IS-LINUX "bin/Linux")
|
||||||
|
(IS-WINDOWS "bin/Windows"))
|
||||||
|
"lua-language-server"))
|
||||||
|
"-E" "-e" "LANG=en"
|
||||||
|
(doom-path +lua-lsp-dir "main.lua")))
|
||||||
|
|
||||||
|
(set-eglot-client! 'lua-mode (+lua-generate-lsp-server-command)))))
|
||||||
|
|
||||||
|
|
||||||
(use-package! moonscript
|
(use-package! moonscript
|
||||||
|
|
|
@ -40,7 +40,10 @@ Can be a list of backends; accepts any value `company-backends' accepts.")
|
||||||
lsp-vetur-global-snippets-dir (expand-file-name "vetur"
|
lsp-vetur-global-snippets-dir (expand-file-name "vetur"
|
||||||
(or (bound-and-true-p +snippets-dir)
|
(or (bound-and-true-p +snippets-dir)
|
||||||
(concat doom-private-dir "snippets/")))
|
(concat doom-private-dir "snippets/")))
|
||||||
lsp-clients-emmy-lua-jar-path (concat lsp-server-install-dir "EmmyLua-LS-all.jar")
|
lsp-clients-lua-language-server-bin (concat lsp-server-install-dir "lua-language-server/"
|
||||||
|
(cond (IS-MAC "bin/macOS")
|
||||||
|
(IS-LINUX "bin/Linux")
|
||||||
|
(IS-WINDOWS "bin/Windows")))
|
||||||
lsp-xml-jar-file (concat lsp-server-install-dir "org.eclipse.lsp4xml-0.3.0-uber.jar")
|
lsp-xml-jar-file (concat lsp-server-install-dir "org.eclipse.lsp4xml-0.3.0-uber.jar")
|
||||||
lsp-groovy-server-file (concat lsp-server-install-dir "groovy-language-server-all.jar"))
|
lsp-groovy-server-file (concat lsp-server-install-dir "groovy-language-server-all.jar"))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue