You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
navigator.lua/lua/navigator.lua

65 lines
1.9 KiB
Lua

3 years ago
local M = {}
_NgConfigValues ={
debug = false, -- log output not implemented
3 years ago
code_action_icon = '',
width = nil, -- valeu of cols TODO allow float e.g. 0.6
height = nil,
on_attach = nil,
-- 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",
3 years ago
code_action_prompt = {
enable = true,
sign = true,
sign_priority = 40,
virtual_text = true,
},
}
3 years ago
vim.cmd("command! -nargs=0 LspLog call v:lua.open_lsp_log()")
vim.cmd("command! -nargs=0 LspRestart call v:lua.reload_lsp()")
vim.cmd([[autocmd filetype * lua require'navigator'.setup()]]) -- BufWinEnter BufNewFile,BufRead ?
3 years ago
local extend_config = function(opts)
opts = opts or {}
if next(opts) == nil then return end
for key,value in pairs(opts) do
if _NgConfigValues[key] == nil then
3 years ago
error(string.format('[] Key %s not valid',key))
return
end
if type(M.config_values[key]) == 'table' then
for k,v in pairs(value) do
_NgConfigValues[key][k] = v
3 years ago
end
else
_NgConfigValues[key] = value
3 years ago
end
end
end
M.config_values = function() return _NgConfigValues end
3 years ago
M.setup = function(cfg)
extend_config(cfg)
-- print("loading navigator")
require('navigator.lspclient').setup(_NgConfigValues)
3 years ago
require('navigator.reference')
require('navigator.definition')
require('navigator.hierarchy')
require('navigator.implementation')
-- log("navigator loader")
if _NgConfigValues.code_action_prompt.enable then
3 years ago
vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'navigator.codeAction'.code_action_prompt()]]
end
-- vim.cmd("autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4")
3 years ago
end
return M