General refactors & reformatting across the board
This commit is contained in:
parent
af91af01fa
commit
8bf902d5f4
25 changed files with 133 additions and 132 deletions
|
@ -1,5 +1,11 @@
|
|||
;;; 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
|
||||
(provide 'smartparens-lua)
|
||||
|
||||
|
@ -16,7 +22,23 @@
|
|||
(set-lookup-handlers! 'lua-mode :documentation 'lua-search-documentation)
|
||||
(set-electric! 'lua-mode :words '("else" "end"))
|
||||
(set-repl-handler! 'lua-mode #'+lua/open-repl)
|
||||
(set-company-backend! 'lua-mode '(company-lua company-yasnippet)))
|
||||
(set-company-backend! 'lua-mode '(company-lua company-yasnippet))
|
||||
|
||||
(set-eglot-client!
|
||||
'lua-mode
|
||||
;; 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 variable changed
|
||||
(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")))
|
||||
|
||||
(when (featurep! +lsp)
|
||||
(add-hook 'lua-mode-local-vars-hook #'lsp!)))
|
||||
|
||||
|
||||
(use-package! moonscript
|
||||
|
@ -31,32 +53,6 @@
|
|||
(when (featurep! :checkers syntax)
|
||||
(require 'flycheck-moonscript nil t)))
|
||||
|
||||
;;
|
||||
;;; LSP
|
||||
(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.")
|
||||
|
||||
;; We need the absolute path to lua-language-server binary
|
||||
;; because the bundled dependencies aren't found otherwise
|
||||
;; The only reason this is a function is to dynamically change
|
||||
;; when/if lua-lsp-dir variable changed
|
||||
(defun doom--abs-path-to-lua-lsp ()
|
||||
"Return the absolute path to lua-language-server."
|
||||
(let ((binary-subdir
|
||||
(cond (IS-MAC "bin/macOS/")
|
||||
(IS-LINUX "bin/Linux/")
|
||||
;; TODO : Forwards or backwards slash for WIN ?
|
||||
(IS-WINDOWS "bin/Windows/")
|
||||
;; TODO : Error or empty string here ?
|
||||
(t ""))))
|
||||
(concat lua-lsp-dir binary-subdir "lua-language-server")))
|
||||
|
||||
(after! lua-mode
|
||||
(set-eglot-client! 'lua-mode `(,(doom--abs-path-to-lua-lsp) "-E" "-e" "LANG=\"en\"" ,(concat lua-lsp-dir "main.lua"))))
|
||||
(when (featurep! +lsp)
|
||||
(add-hook 'lua-mode-local-vars-hook #'lsp!))
|
||||
|
||||
;;
|
||||
;;; Frameworks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue