change sumneko setup, move it to lsp section

neovim_0_5
ray-x 3 years ago
parent 624053bd8f
commit d8385f2993

@ -10,9 +10,6 @@ _NgConfigValues = {
-- function(client, bufnr)
-- -- your on_attach will be called at end of navigator on_attach
-- end,
sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server",
sumneko_binary = vim.fn.expand("$HOME")
.. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
code_action_prompt = {enable = true, sign = true, sign_priority = 40, virtual_text = true},
treesitter_analysis = true, -- treesitter variable context
lsp = {
@ -20,6 +17,11 @@ _NgConfigValues = {
tsserver = {
filetypes = {'typescript'} -- disable javascript etc,
-- set to {} to disable the lspclient for all filetype
},
sumneko_lua = {
-- sumneko_root_path = sumneko_root_path,
-- sumneko_binary = sumneko_binary,
-- cmd = {'lua-language-server'}
}
}
}
@ -45,6 +47,9 @@ local extend_config = function(opts)
_NgConfigValues[key] = value
end
end
if _NgConfigValues.sumneko_root_path or _NgConfigValues.sumneko_binary then
vim.notify("Please put sumneko setup in lsp['sumneko_lua']", vim.log.levels.WARN)
end
end
M.config_values = function()

@ -36,8 +36,6 @@ local on_attach = require("navigator.lspclient.attach").on_attach
-- gopls["ui.completion.usePlaceholders"] = true
-- lua setup
local sumneko_root_path = config.sumneko_root_path
local sumneko_binary = config.sumneko_binary
local library = {}
local path = vim.split(package.path, ";")
@ -171,7 +169,7 @@ local setups = {
}
},
sumneko_lua = {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
cmd = {"lua-language-server"},
filetypes = {"lua"},
on_attach = on_attach,
settings = {
@ -289,7 +287,7 @@ local function wait_lsp_startup(ft, retry, lsp_opts)
if lsp_opts[lspclient] ~= nil then
-- log(lsp_opts[lspclient], cfg)
cfg = vim.tbl_deep_extend("force", cfg, lsp_opts[lspclient])
-- log(cfg)
trace(cfg)
end
load_cfg(ft, lspclient, cfg, loaded)
@ -306,7 +304,7 @@ local function wait_lsp_startup(ft, retry, lsp_opts)
i = i + 1
if i > 5 or #clients > 0 then
timer:close() -- Always close handles to avoid leaks.
trace("active", #clients, i)
log("active", #clients, i)
_Loading = false
return true
end
@ -358,13 +356,24 @@ local function setup(user_opts)
return
end
log('setup', user_opts)
trace('setup', user_opts)
log("loading for ft ", ft, uri)
highlight.diagnositc_config_sign()
highlight.add_highlight()
local lsp_opts = user_opts.lsp
_Loading = true
if vim.bo.filetype == 'lua' then
local slua = lsp_opts.sumneko_lua
if slua and not slua.cmd then
if slua.sumneko_root_path and slua.sumneko_binary then
lsp_opts.sumneko_lua.cmd = {slua.sumneko_binary, "-E", slua.sumneko_root_path .. "/main.lua"}
else
lsp_opts.sumneko_lua.cmd = {"lua-language-server"}
end
end
end
wait_lsp_startup(ft, retry, lsp_opts)
_LoadedClients[ft] = true
_Loading = false

@ -24,17 +24,20 @@ local function get_pads(win_width, text, postfix)
if sz < 30 then
sz = 30
end
local space = ''
local space
local i = math.floor((sz + 10) / 10)
i = i * 10 - #text
if i + #text + #postfix + 2 < win_width then
-- push to left twice
local rem = win_width - i - #text - #postfix
local rem2 = (rem - 2) / 10
if rem2 > 0 then
i = i + rem2 * 10
rem = (rem - 2) / 10
if rem > 0 then
i = i + rem * 10
rem = (i + #text) % 10
-- i = i - rem
end
end
space = string.rep(' ', i)

Loading…
Cancel
Save