nvim: lsp: add lua-language-server support

This commit is contained in:
tastytea 2022-08-10 19:44:57 +02:00
parent fd529cdd5f
commit b5b2e94faa
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 26 additions and 0 deletions

View File

@ -11,6 +11,9 @@ packer.use {
requires = 'https://github.com/neovim/nvim-lspconfig', requires = 'https://github.com/neovim/nvim-lspconfig',
config = function() config = function()
local cmp = require'cmp' local cmp = require'cmp'
if (cmp == nil) then
return
end
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -71,6 +74,9 @@ packer.use {
require('lspconfig')['clangd'].setup { require('lspconfig')['clangd'].setup {
capabilities = capabilities capabilities = capabilities
} }
require('lspconfig')['sumneko_lua'].setup {
capabilities = capabilities
}
cmp.setup.filetype('lua', { cmp.setup.filetype('lua', {
sources = cmp.config.sources({ sources = cmp.config.sources({

View File

@ -68,5 +68,25 @@ packer.use {
}, },
on_attach = on_attach on_attach = on_attach
} }
require'lspconfig'.sumneko_lua.setup {
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = {'vim'},
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
on_attach = on_attach
}
end end
} }