Configure lua lsp to have vim and use as global variables
This commit is contained in:
parent
1c10794866
commit
595a4d287b
@ -1,5 +1,3 @@
|
||||
local utils = require('utils')
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' }
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
@ -127,6 +125,34 @@ lsp_installer.on_server_ready(function(server)
|
||||
return
|
||||
end
|
||||
|
||||
if server.name == 'sumneko_lua' then
|
||||
local lua_rtp = vim.split(package.path, ';')
|
||||
table.insert(lua_rtp, 'lua/?.lua')
|
||||
table.insert(lua_rtp, 'lua/?/init.lua')
|
||||
opts.settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
-- Setup your lua path
|
||||
path = lua_rtp,
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim', 'use' },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
|
||||
server:setup(opts)
|
||||
vim.cmd([[ do User LspAttachBuffers ]])
|
||||
|
Loading…
x
Reference in New Issue
Block a user