2024-03-06 02:24:31 +01:00
|
|
|
vim.bo.comments = ':---,:--'
|
|
|
|
|
|
|
|
local lua_ls_cmd = 'lua-language-server'
|
|
|
|
|
|
|
|
-- Check if lua-language-server is available
|
|
|
|
if vim.fn.executable(lua_ls_cmd) ~= 1 then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2024-09-19 01:24:20 +02:00
|
|
|
-- require'lspconfig'.lua_ls.setup{}
|
|
|
|
|
2024-03-06 02:24:31 +01:00
|
|
|
local root_files = {
|
|
|
|
'.luarc.json',
|
|
|
|
'.luarc.jsonc',
|
|
|
|
'.luacheckrc',
|
|
|
|
'.stylua.toml',
|
|
|
|
'stylua.toml',
|
|
|
|
'selene.toml',
|
|
|
|
'selene.yml',
|
|
|
|
'.git',
|
|
|
|
}
|
|
|
|
|
|
|
|
vim.lsp.start {
|
|
|
|
name = 'luals',
|
|
|
|
cmd = { lua_ls_cmd },
|
|
|
|
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
|
|
|
|
capabilities = require('user.lsp').make_client_capabilities(),
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
runtime = {
|
|
|
|
version = 'LuaJIT',
|
|
|
|
},
|
|
|
|
diagnostics = {
|
|
|
|
-- Get the language server to recognize the `vim` global, etc.
|
|
|
|
globals = {
|
|
|
|
'vim',
|
|
|
|
'describe',
|
|
|
|
'it',
|
|
|
|
'assert',
|
|
|
|
'stub',
|
|
|
|
},
|
|
|
|
disable = {
|
|
|
|
'duplicate-set-field',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
workspace = {
|
|
|
|
checkThirdParty = false,
|
|
|
|
},
|
|
|
|
telemetry = {
|
|
|
|
enable = false,
|
|
|
|
},
|
|
|
|
hint = { -- inlay hints (supported in Neovim >= 0.10)
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|