Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua lsp #62

Merged
merged 2 commits into from
Aug 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions lua/config/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,36 +148,27 @@ if utils.executable('bash-language-server') then
})
end

local sumneko_binary_path = fn.exepath("lua-language-server")
if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then
local sumneko_root_path = fn.fnamemodify(sumneko_binary_path, ":h:h:h")

local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")

if utils.executable("lua-language-server") then
-- settings for lua-language-server can be found on https://github.com/sumneko/lua-language-server/wiki/Settings .
lspconfig.sumneko_lua.setup({
on_attach = custom_attach,
cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/main.lua" },
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 = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
-- Make the server aware of Neovim runtime files,
-- see also https://github.com/sumneko/lua-language-server/wiki/Libraries#link-to-workspace .
-- Lua-dev.nvim also has similar settings for sumneko lua, https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua .
library = { fn.stdpath('data') .. "/site/pack/packer/opt/emmylua-nvim" },
maxPreload = 2000,
preloadFileSize = 50000,
},
},
},
Expand Down