Merge pull request #3562 from gagbo/feature/lsp-mode-lua-langserver
Add support for lua-langserver in lsp-mode
This commit is contained in:
commit
fc65cd83e8
2 changed files with 20 additions and 0 deletions
18
modules/lang/lua/+lsp-mode.el
Normal file
18
modules/lang/lua/+lsp-mode.el
Normal 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)))
|
|
@ -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!)))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue