Skip to content

Commit 9e17c69

Browse files
committed
Actually get lua language server working
Editing the init file is still painful though :/
1 parent 5728068 commit 9e17c69

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

init.lua

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,25 @@ vim.lsp.config('clangd', {
186186
})
187187
vim.lsp.enable 'clangd'
188188

189+
vim.lsp.config('luals', {
190+
-- Command and arguments to start the server.
191+
cmd = { 'lua-language-server' },
192+
-- Filetypes to automatically attach to.
193+
filetypes = { 'lua' },
194+
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
195+
settings = {
196+
Lua = {
197+
diagnostics = {
198+
globals = { 'vim' },
199+
},
200+
runtime = {
201+
version = 'LuaJIT',
202+
},
203+
},
204+
},
205+
})
206+
vim.lsp.enable 'luals'
207+
189208
-- [[ Basic Autocommands ]]
190209
-- See `:help lua-guide-autocommands`
191210

@@ -727,31 +746,14 @@ require('lazy').setup({
727746
-- - filetypes (table): Override the default list of associated filetypes for the server
728747
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
729748
-- - settings (table): Override the default settings passed when initializing the server.
730-
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
749+
-- For example, to see the options for `lua_ls`, you could go to: https://lals.github.io/wiki/settings/
731750
local servers = {
732751
-- pyright = {},
733752
rust_analyzer = {},
734753
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
735-
--
736-
-- Some languages (like typescript) have entire language plugins that can be useful:
737-
-- https://github.com/pmizio/typescript-tools.nvim
738-
--
739-
-- But for many setups, the LSP (`ts_ls`) will work just fine
740-
-- ts_ls = {},
741-
--
742-
743-
lua_ls = {
744-
settings = {
745-
Lua = {
746-
completion = {
747-
callSnippet = 'Replace',
748-
},
749-
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
750-
-- diagnostics = { disable = { 'missing-fields' } },
751-
},
752-
},
754+
lua_ls = {},
753755
},
754-
}
756+
755757

756758
-- Ensure the servers and tools above are installed
757759
--

0 commit comments

Comments
 (0)