Merge pull request #3562 from gagbo/feature/lsp-mode-lua-langserver

Add support for lua-langserver in lsp-mode
This commit is contained in:
Henrik Lissner 2020-07-17 20:15:53 -04:00 committed by GitHub
commit fc65cd83e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,18 @@
;;; lang/lua/+lsp-mode.el -*- lexical-binding: t; -*-
(defun lsp-lua-langserver--lsp-command ()
"Generate LSP startup command."
(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")))
(after! lsp-mode
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection 'lsp-lua-langserver--lsp-command)
:major-modes '(lua-mode)
:priority -1
:server-id 'lua-langserver)))

View file

@ -38,6 +38,8 @@ lua-language-server.")
(doom-path lua-lsp-dir "main.lua"))) (doom-path lua-lsp-dir "main.lua")))
(when (featurep! +lsp) (when (featurep! +lsp)
(unless (featurep! :tools lsp +eglot)
(load! "+lsp-mode"))
(add-hook 'lua-mode-local-vars-hook #'lsp!))) (add-hook 'lua-mode-local-vars-hook #'lsp!)))