From 40c9496e1fe8690f9f476f71b0bdb3f6094387e5 Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Tue, 2 Mar 2021 17:05:45 +0300 Subject: [PATCH] emacs/neovim: add `lua-language-server` --- home/.config/doom/config.el | 2 ++ home/.config/doom/init.el | 2 +- home/.config/nvim/coc-settings.json | 33 +++++++++++++++++++++++++++-- setup/lua-language-server.sh | 24 +++++++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100755 setup/lua-language-server.sh diff --git a/home/.config/doom/config.el b/home/.config/doom/config.el index f150615..fc8fba0 100644 --- a/home/.config/doom/config.el +++ b/home/.config/doom/config.el @@ -109,6 +109,8 @@ "--header-insertion=iwyu" "--header-insertion-decorators")) ;;(after! lsp-clangd (set-lsp-priority! 'clangd 2)) ;; Prefer clangd instead of default ccls +(setq lua-lsp-dir "~/.config/emacs/.local/etc/lsp/lua-language-server/" + lua-lsp-completion-call-snippet "Replace") ;; Quicker which-key (after! which-key diff --git a/home/.config/doom/init.el b/home/.config/doom/init.el index b10ccf3..ece7642 100644 --- a/home/.config/doom/init.el +++ b/home/.config/doom/init.el @@ -159,7 +159,7 @@ ;;lean ;;factor ;;ledger ; an accounting system in Emacs - lua ; one-based indices? one-based indices + (lua +lsp) ; one-based indices? one-based indices (markdown ; writing docs for people to ignore +grip) ;;nim ; python + lisp at the speed of c diff --git a/home/.config/nvim/coc-settings.json b/home/.config/nvim/coc-settings.json index aa9acc3..8add8fd 100644 --- a/home/.config/nvim/coc-settings.json +++ b/home/.config/nvim/coc-settings.json @@ -76,7 +76,7 @@ ] }, "coc-actions.useCursorLine": true, - "python.venvPath": "~/.local/share/pyenv/versions", + "python.venvPath": "/home/follie/.local/share/pyenv/versions", "python.pythonPath": "python3", "python.linting.enabled": true, "python.linting.banditEnabled": true, @@ -91,6 +91,34 @@ ], "clangd.semanticHighlighting": true, "languageserver": { + "lua-language-server": { + "command": "/home/follie/.local/share/nvim/lsp/lua-language-server/bin/Linux/lua-language-server", + "args": [ + "-E", + "/home/follie/.local/share/nvim/lsp/lua-language-server/main.lua" + ], + "filetypes": [ + "lua" + ], + "rootPatterns": [ + ".git/", + ".hg/", + ".projectile" + ], + "settings": { + "Lua": { + "completion": { + "callSnippet": "Replace" + }, + "hint": { + "enable": true + }, + "telemetry": { + "enable": false + } + } + } + }, "ccls": { "command": "ccls", "filetypes": [ @@ -105,7 +133,8 @@ ".ccls", "compile_commands.json", ".git/", - ".hg/" + ".hg/", + ".projectile" ], "initializationOptions": { "cache": { diff --git a/setup/lua-language-server.sh b/setup/lua-language-server.sh new file mode 100755 index 0000000..5c8a1e6 --- /dev/null +++ b/setup/lua-language-server.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# clone the repo +git clone https://github.com/sumneko/lua-language-server +cd lua-language-server || exit +git submodule update --init --recursive + +# build +# You need `ninja` +cd 3rd/luamake || exit +ninja -f ninja/linux.ninja +cd ../.. +./3rd/luamake/luamake rebuild + +# Just for the convenience sake +cd ../ +mv -rfv lua-language-server ~/Code/lua-language-server + +# For coc.nvim +mkdir -pv ~/.local/share/nvim/lsp +ln -sv ~/Code/lua-language-server ~/.local/share/nvim/lsp/ +# For Doom Emacs +mkdir -pv ~/.config/emacs/.local/etc/lsp +ln -sv ~/Code/lua-language-server ~/.config/emacs/.local/etc/lsp/