2022-02-17 11:21:34 +00:00
|
|
|
local util = require('navigator.util')
|
|
|
|
local log = util.log
|
|
|
|
local trace = util.trace
|
2021-04-19 02:56:32 +00:00
|
|
|
|
|
|
|
local event_hdlrs = {
|
2022-01-12 09:12:51 +00:00
|
|
|
{ ev = 'BufWritePre', func = [[require "navigator.diagnostics".set_diag_loclist()]] },
|
|
|
|
{ ev = 'CursorHold', func = 'document_highlight()' },
|
|
|
|
{ ev = 'CursorHoldI', func = 'document_highlight()' },
|
|
|
|
{ ev = 'CursorMoved', func = 'clear_references()' },
|
2021-04-19 02:56:32 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 09:12:51 +00:00
|
|
|
local double = { '╔', '═', '╗', '║', '╝', '═', '╚', '║' }
|
|
|
|
local single = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }
|
|
|
|
-- TODO https://github.com/neovim/neovim/pull/16591 use vimkeymap.set/del
|
2021-06-29 03:32:42 +00:00
|
|
|
-- LuaFormatter off
|
2021-04-19 02:56:32 +00:00
|
|
|
local key_maps = {
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = 'gr', func = "require('navigator.reference').reference()" },
|
2021-12-23 08:17:48 +00:00
|
|
|
{ key = 'Gr', func = "require('navigator.reference').async_ref()" },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ mode = 'i', key = '<M-k>', func = 'signature_help()' },
|
|
|
|
{ key = '<c-k>', func = 'signature_help()' },
|
|
|
|
{ key = 'g0', func = "require('navigator.symbols').document_symbols()" },
|
2021-12-24 06:30:56 +00:00
|
|
|
{ key = 'gW', func = "require('navigator.workspace').workspace_symbol()" },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = '<c-]>', func = "require('navigator.definition').definition()" },
|
2022-02-17 03:54:52 +00:00
|
|
|
{ key = 'gd', func = "require('navigator.definition').definition()" },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = 'gD', func = "declaration({ border = 'rounded', max_width = 80 })" },
|
|
|
|
{ key = 'gp', func = "require('navigator.definition').definition_preview()" },
|
2022-01-12 09:12:51 +00:00
|
|
|
{ key = '<Leader>gt', func = "require('navigator.treesitter').buf_ts()" },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = '<Leader>gT', func = "require('navigator.treesitter').bufs_ts()" },
|
|
|
|
{ key = 'K', func = 'hover({ popup_opts = { border = single, max_width = 80 }})' },
|
|
|
|
{ key = '<Space>ca', mode = 'n', func = "require('navigator.codeAction').code_action()" },
|
|
|
|
{ key = '<Space>cA', mode = 'v', func = 'range_code_action()' },
|
2021-12-24 06:30:56 +00:00
|
|
|
-- { key = '<Leader>re', func = 'rename()' },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = '<Space>rn', func = "require('navigator.rename').rename()" },
|
|
|
|
{ key = '<Leader>gi', func = 'incoming_calls()' },
|
|
|
|
{ key = '<Leader>go', func = 'outgoing_calls()' },
|
|
|
|
{ key = 'gi', func = 'implementation()' },
|
|
|
|
{ key = '<Space>D', func = 'type_definition()' },
|
|
|
|
{ key = 'gL', func = "require('navigator.diagnostics').show_diagnostics()" },
|
|
|
|
{ key = 'gG', func = "require('navigator.diagnostics').show_buf_diagnostics()" },
|
|
|
|
{ key = '<Leader>dt', func = "require('navigator.diagnostics').toggle_diagnostics()" },
|
|
|
|
{ key = ']d', func = "diagnostic.goto_next({ border = 'rounded', max_width = 80})" },
|
|
|
|
{ key = '[d', func = "diagnostic.goto_prev({ border = 'rounded', max_width = 80})" },
|
2022-02-17 11:21:34 +00:00
|
|
|
{ key = ']O', func = 'diagnostic.set_loclist()' },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = ']r', func = "require('navigator.treesitter').goto_next_usage()" },
|
|
|
|
{ key = '[r', func = "require('navigator.treesitter').goto_previous_usage()" },
|
|
|
|
{ key = '<C-LeftMouse>', func = 'definition()' },
|
|
|
|
{ key = 'g<LeftMouse>', func = 'implementation()' },
|
|
|
|
{ key = '<Leader>k', func = "require('navigator.dochighlight').hi_symbol()" },
|
2021-12-24 06:30:56 +00:00
|
|
|
{ key = '<Space>wa', func = "require('navigator.workspace').add_workspace_folder()" },
|
|
|
|
{ key = '<Space>wr', func = "require('navigator.workspace').remove_workspace_folder()" },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = '<Space>ff', func = 'formatting()', mode = 'n' },
|
|
|
|
{ key = '<Space>ff', func = 'range_formatting()', mode = 'v' },
|
2021-12-24 06:30:56 +00:00
|
|
|
{ key = '<Space>wl', func = "require('navigator.workspace').list_workspace_folders()" },
|
2021-12-19 02:16:17 +00:00
|
|
|
{ key = '<Space>la', mode = 'n', func = "require('navigator.codelens').run_action()" },
|
2021-04-19 02:56:32 +00:00
|
|
|
}
|
2021-12-19 02:16:17 +00:00
|
|
|
|
|
|
|
local key_maps_help = {}
|
2021-06-29 03:32:42 +00:00
|
|
|
-- LuaFormatter on
|
2021-07-23 00:19:19 +00:00
|
|
|
local M = {}
|
2021-04-19 02:56:32 +00:00
|
|
|
|
2021-06-23 14:09:33 +00:00
|
|
|
local ccls_mappings = {
|
2022-01-12 09:12:51 +00:00
|
|
|
{ key = '<Leader>gi', func = "require('navigator.cclshierarchy').incoming_calls()" },
|
|
|
|
{ key = '<Leader>go', func = "require('navigator.cclshierarchy').outgoing_calls()" },
|
2021-06-23 14:09:33 +00:00
|
|
|
}
|
|
|
|
|
2021-10-14 03:55:40 +00:00
|
|
|
local check_cap = function(cap)
|
2021-09-07 11:08:00 +00:00
|
|
|
-- log(vim.lsp.buf_get_clients(0))
|
2021-09-20 04:19:00 +00:00
|
|
|
local fmt, rfmt, ccls
|
2021-10-14 03:55:40 +00:00
|
|
|
if cap and cap.document_formatting then
|
|
|
|
fmt = true
|
|
|
|
end
|
|
|
|
if cap and cap.document_range_formatting then
|
|
|
|
rfmt = true
|
|
|
|
end
|
2021-09-07 11:08:00 +00:00
|
|
|
for _, value in pairs(vim.lsp.buf_get_clients(0)) do
|
2021-10-14 03:55:40 +00:00
|
|
|
trace(value)
|
2021-09-20 04:19:00 +00:00
|
|
|
if value ~= nil and value.resolved_capabilities == nil then
|
|
|
|
if value.resolved_capabilities.document_formatting then
|
|
|
|
fmt = true
|
|
|
|
end
|
|
|
|
if value.resolved_capabilities.document_range_formatting then
|
|
|
|
rfmt = true
|
|
|
|
end
|
2021-09-07 11:08:00 +00:00
|
|
|
|
2021-12-19 02:16:17 +00:00
|
|
|
log('override ccls', value.config)
|
|
|
|
if value.config.name == 'ccls' then
|
2021-09-20 04:19:00 +00:00
|
|
|
ccls = true
|
|
|
|
end
|
2021-09-07 11:08:00 +00:00
|
|
|
end
|
|
|
|
end
|
2021-09-20 04:19:00 +00:00
|
|
|
return fmt, rfmt, ccls
|
2021-09-07 11:08:00 +00:00
|
|
|
end
|
|
|
|
|
2021-04-19 02:56:32 +00:00
|
|
|
local function set_mapping(user_opts)
|
2021-10-13 09:27:46 +00:00
|
|
|
log('setup mapping')
|
2022-01-12 09:12:51 +00:00
|
|
|
local opts = { noremap = true, silent = true }
|
2021-05-03 10:45:51 +00:00
|
|
|
user_opts = user_opts or {}
|
|
|
|
|
2021-09-07 11:08:00 +00:00
|
|
|
local user_key = _NgConfigValues.keymaps or {}
|
2021-05-03 10:45:51 +00:00
|
|
|
local bufnr = user_opts.bufnr or 0
|
|
|
|
|
2021-09-07 11:08:00 +00:00
|
|
|
local function del_keymap(...)
|
|
|
|
vim.api.nvim_buf_del_keymap(bufnr, ...)
|
2021-05-21 11:39:46 +00:00
|
|
|
end
|
2021-05-03 10:45:51 +00:00
|
|
|
|
2021-09-07 11:08:00 +00:00
|
|
|
local function set_keymap(...)
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
|
|
|
end
|
2021-05-03 10:45:51 +00:00
|
|
|
-- local function buf_set_option(...)
|
|
|
|
-- vim.api.nvim_buf_set_option(bufnr, ...)
|
|
|
|
-- end
|
2021-10-14 03:55:40 +00:00
|
|
|
local doc_fmt, range_fmt, ccls = check_cap(user_opts.cap)
|
2021-09-07 11:08:00 +00:00
|
|
|
|
|
|
|
if ccls then
|
2021-09-07 15:06:58 +00:00
|
|
|
vim.list_extend(key_maps, ccls_mappings)
|
2021-09-07 11:08:00 +00:00
|
|
|
end
|
|
|
|
|
2021-10-18 23:04:14 +00:00
|
|
|
if _NgConfigValues.default_mapping ~= false then
|
|
|
|
for _, v in pairs(user_key) do
|
2021-12-19 02:16:17 +00:00
|
|
|
trace('binding', v)
|
2021-10-18 23:04:14 +00:00
|
|
|
local exists = false
|
|
|
|
for _, default in pairs(key_maps) do
|
2021-12-25 01:43:40 +00:00
|
|
|
if v.func == default.func and (v.mode or 'n') == (default.mode or 'n') and not default.override then
|
2021-10-18 23:04:14 +00:00
|
|
|
default.key, default.override, exists = v.key, true, true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if not exists then
|
|
|
|
table.insert(key_maps, v)
|
2021-05-03 10:45:51 +00:00
|
|
|
end
|
2021-04-19 02:56:32 +00:00
|
|
|
end
|
2021-10-18 23:04:14 +00:00
|
|
|
else
|
|
|
|
key_maps = _NgConfigValues.keymaps or {}
|
2021-12-19 02:16:17 +00:00
|
|
|
log('setting maps to ', key_maps)
|
2021-05-03 10:45:51 +00:00
|
|
|
end
|
2021-09-07 11:08:00 +00:00
|
|
|
local fmtkey, rfmtkey
|
2021-05-03 10:45:51 +00:00
|
|
|
for _, value in pairs(key_maps) do
|
2021-12-19 02:16:17 +00:00
|
|
|
local f = '<Cmd>lua vim.lsp.buf.' .. value.func .. '<CR>'
|
|
|
|
if string.find(value.func, 'require') then
|
|
|
|
f = '<Cmd>lua ' .. value.func .. '<CR>'
|
|
|
|
elseif string.find(value.func, 'diagnostic') then
|
2021-09-19 02:42:34 +00:00
|
|
|
local diagnostic = '<Cmd>lua vim.'
|
2022-02-17 11:21:34 +00:00
|
|
|
if vim.diagnostic ~= nil then
|
|
|
|
diagnostic = '<Cmd>lua vim.'
|
|
|
|
else
|
|
|
|
util.error('Please update nvim to 0.6.1+')
|
2021-09-19 02:42:34 +00:00
|
|
|
end
|
2021-12-19 02:16:17 +00:00
|
|
|
f = diagnostic .. value.func .. '<CR>'
|
|
|
|
elseif string.find(value.func, 'vim.') then
|
|
|
|
f = '<Cmd>lua ' .. value.func .. '<CR>'
|
2021-05-02 13:54:30 +00:00
|
|
|
end
|
2021-05-03 10:45:51 +00:00
|
|
|
local k = value.key
|
2021-12-19 02:16:17 +00:00
|
|
|
local m = value.mode or 'n'
|
|
|
|
if string.find(value.func, 'range_formatting') then
|
2021-09-07 11:08:00 +00:00
|
|
|
rfmtkey = value.key
|
2021-12-19 02:16:17 +00:00
|
|
|
elseif string.find(value.func, 'formatting') then
|
2021-09-07 11:08:00 +00:00
|
|
|
fmtkey = value.key
|
2021-06-23 14:09:33 +00:00
|
|
|
end
|
2022-02-17 11:21:34 +00:00
|
|
|
trace('binding', k, f)
|
2021-09-07 11:08:00 +00:00
|
|
|
set_keymap(m, k, f, opts)
|
2021-05-03 10:45:51 +00:00
|
|
|
end
|
|
|
|
|
2021-12-19 02:16:17 +00:00
|
|
|
for _, val in pairs(key_maps) do
|
|
|
|
table.insert(key_maps_help, (val.mode or 'n') .. '|' .. val.key .. '|' .. val.func)
|
|
|
|
end
|
|
|
|
|
2021-05-03 10:45:51 +00:00
|
|
|
-- if user_opts.cap.document_formatting then
|
2021-10-13 09:27:46 +00:00
|
|
|
|
2021-10-20 00:22:41 +00:00
|
|
|
if doc_fmt and _NgConfigValues.lsp.format_on_save then
|
2021-07-23 00:19:19 +00:00
|
|
|
vim.cmd([[
|
2021-06-12 02:15:16 +00:00
|
|
|
aug NavigatorAuFormat
|
|
|
|
au!
|
|
|
|
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting()
|
|
|
|
aug END
|
2021-07-23 00:19:19 +00:00
|
|
|
]])
|
2021-10-18 23:04:14 +00:00
|
|
|
elseif fmtkey then
|
2021-09-07 11:08:00 +00:00
|
|
|
del_keymap('n', fmtkey)
|
2021-05-03 10:45:51 +00:00
|
|
|
end
|
2021-10-17 04:29:17 +00:00
|
|
|
|
2022-02-21 00:42:24 +00:00
|
|
|
if user_opts.cap and user_opts.cap.document_range_formatting then
|
2021-12-19 02:16:17 +00:00
|
|
|
log('formatting enabled', user_opts.cap)
|
2021-10-14 03:55:40 +00:00
|
|
|
end
|
2021-10-17 04:29:17 +00:00
|
|
|
|
2022-02-21 04:22:05 +00:00
|
|
|
|
2021-10-18 23:04:14 +00:00
|
|
|
if not range_fmt and rfmtkey then
|
2021-12-19 02:16:17 +00:00
|
|
|
del_keymap('v', rfmtkey)
|
2021-05-17 03:15:15 +00:00
|
|
|
end
|
2021-09-07 11:08:00 +00:00
|
|
|
|
2021-12-19 02:16:17 +00:00
|
|
|
log('enable format ', doc_fmt, range_fmt)
|
2021-04-19 02:56:32 +00:00
|
|
|
end
|
|
|
|
|
2021-05-29 11:08:30 +00:00
|
|
|
local function autocmd(user_opts)
|
2022-01-12 09:12:51 +00:00
|
|
|
vim.api.nvim_exec(
|
|
|
|
[[
|
2021-06-12 02:15:16 +00:00
|
|
|
aug NavigatorDocHlAu
|
2021-05-29 11:08:30 +00:00
|
|
|
au!
|
|
|
|
au CmdlineLeave : lua require('navigator.dochighlight').cmd_nohl()
|
|
|
|
aug END
|
2022-01-12 09:12:51 +00:00
|
|
|
]],
|
|
|
|
false
|
|
|
|
)
|
2021-05-29 11:08:30 +00:00
|
|
|
end
|
|
|
|
|
2021-04-19 02:56:32 +00:00
|
|
|
local function set_event_handler(user_opts)
|
2021-05-03 10:45:51 +00:00
|
|
|
user_opts = user_opts or {}
|
2021-05-21 11:39:46 +00:00
|
|
|
local file_types =
|
2022-01-12 09:12:51 +00:00
|
|
|
'c,cpp,h,go,python,vim,sh,javascript,html,css,lua,typescript,rust,javascriptreact,typescriptreact,json,yaml,kotlin,php,dart,nim,terraform,java'
|
2021-05-03 10:45:51 +00:00
|
|
|
-- local format_files = "c,cpp,h,go,python,vim,javascript,typescript" --html,css,
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.api.nvim_command([[augroup nvim_lsp_autos]])
|
|
|
|
vim.api.nvim_command([[autocmd!]])
|
2021-05-03 10:45:51 +00:00
|
|
|
|
|
|
|
for _, value in pairs(event_hdlrs) do
|
2021-12-19 02:16:17 +00:00
|
|
|
local f = ''
|
|
|
|
if string.find(value.func, 'require') ~= nil then
|
|
|
|
f = 'lua ' .. value.func
|
2021-05-03 10:45:51 +00:00
|
|
|
else
|
2021-12-19 02:16:17 +00:00
|
|
|
f = 'lua vim.lsp.buf.' .. value.func
|
2021-04-19 02:56:32 +00:00
|
|
|
end
|
2021-12-19 02:16:17 +00:00
|
|
|
local cmd = 'autocmd FileType ' .. file_types .. ' autocmd nvim_lsp_autos ' .. value.ev .. ' <buffer> silent! ' .. f
|
2021-05-03 10:45:51 +00:00
|
|
|
vim.api.nvim_command(cmd)
|
|
|
|
end
|
|
|
|
vim.api.nvim_command([[augroup END]])
|
2021-04-19 02:56:32 +00:00
|
|
|
end
|
|
|
|
|
2021-07-23 00:19:19 +00:00
|
|
|
M.toggle_lspformat = function(on)
|
|
|
|
if on == nil then
|
|
|
|
_NgConfigValues.lsp.format_on_save = not _NgConfigValues.lsp.format_on_save
|
|
|
|
else
|
|
|
|
_NgConfigValues.lsp.format_on_save = on
|
|
|
|
end
|
|
|
|
if _NgConfigValues.lsp.format_on_save then
|
|
|
|
if on == nil then
|
2021-12-23 05:37:39 +00:00
|
|
|
vim.notify('format on save true', vim.lsp.log_levels.INFO)
|
2021-07-23 00:19:19 +00:00
|
|
|
end
|
2021-12-07 21:05:49 +00:00
|
|
|
vim.cmd([[set eventignore-=BufWritePre]])
|
2021-07-23 00:19:19 +00:00
|
|
|
else
|
|
|
|
if on == nil then
|
2021-12-23 05:37:39 +00:00
|
|
|
vim.notify('format on save false', vim.lsp.log_levels.INFO)
|
2021-07-23 00:19:19 +00:00
|
|
|
end
|
2021-12-07 21:05:49 +00:00
|
|
|
vim.cmd([[set eventignore+=BufWritePre]])
|
2021-07-23 00:19:19 +00:00
|
|
|
end
|
|
|
|
end
|
2021-04-19 02:56:32 +00:00
|
|
|
|
|
|
|
function M.setup(user_opts)
|
2021-06-09 10:51:38 +00:00
|
|
|
user_opts = user_opts or _NgConfigValues
|
2021-10-18 23:04:14 +00:00
|
|
|
set_mapping(user_opts)
|
2021-05-28 00:10:28 +00:00
|
|
|
|
2021-05-29 11:08:30 +00:00
|
|
|
autocmd(user_opts)
|
2021-05-03 10:45:51 +00:00
|
|
|
set_event_handler(user_opts)
|
2021-05-21 11:39:46 +00:00
|
|
|
|
2022-02-17 11:21:34 +00:00
|
|
|
local client = user_opts.client or {}
|
|
|
|
local cap = client.resolved_capabilities or vim.lsp.protocol.make_client_capabilities()
|
|
|
|
|
2021-09-22 14:43:31 +00:00
|
|
|
log('lsp cap:', cap)
|
|
|
|
|
2021-05-14 09:10:13 +00:00
|
|
|
if cap.call_hierarchy or cap.callHierarchy then
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['callHierarchy/incomingCalls'] = require('navigator.hierarchy').incoming_calls_handler
|
|
|
|
vim.lsp.handlers['callHierarchy/outgoingCalls'] = require('navigator.hierarchy').outgoing_calls_handler
|
2021-05-03 10:45:51 +00:00
|
|
|
end
|
|
|
|
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['textDocument/references'] = require('navigator.reference').reference_handler
|
2021-12-16 21:54:36 +00:00
|
|
|
-- vim.lsp.handlers["textDocument/codeAction"] = require"navigator.codeAction".code_action_handler
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['textDocument/definition'] = require('navigator.definition').definition_handler
|
2021-05-03 10:45:51 +00:00
|
|
|
|
|
|
|
if cap.declaration then
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['textDocument/declaration'] = require('navigator.definition').declaration_handler
|
2021-05-03 10:45:51 +00:00
|
|
|
end
|
|
|
|
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['textDocument/typeDefinition'] = require('navigator.definition').typeDefinition_handler
|
|
|
|
vim.lsp.handlers['textDocument/implementation'] = require('navigator.implementation').implementation_handler
|
2021-05-03 10:45:51 +00:00
|
|
|
|
2021-12-24 06:30:56 +00:00
|
|
|
-- vim.lsp.handlers['textDocument/documentSymbol'] = require('navigator.symbols').document_symbol_handler
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['workspace/symbol'] = require('navigator.symbols').workspace_symbol_handler
|
|
|
|
vim.lsp.handlers['textDocument/publishDiagnostics'] = require('navigator.diagnostics').diagnostic_handler
|
2021-05-03 10:45:51 +00:00
|
|
|
|
2021-06-17 23:24:02 +00:00
|
|
|
-- TODO: when active signature merge to neovim, remove this setup:
|
2021-09-19 02:42:34 +00:00
|
|
|
|
2022-01-12 09:12:51 +00:00
|
|
|
if
|
|
|
|
_NgConfigValues.signature_help_cfg and #_NgConfigValues.signature_help_cfg > 0 or _NgConfigValues.lsp_signature_help
|
|
|
|
then
|
2021-12-19 02:16:17 +00:00
|
|
|
log('setup signature from navigator')
|
|
|
|
local hassig, sig = pcall(require, 'lsp_signature')
|
2021-09-19 02:42:34 +00:00
|
|
|
if hassig then
|
2021-11-05 01:33:40 +00:00
|
|
|
sig.setup(_NgConfigValues.signature_help_cfg or {})
|
2021-09-14 00:41:13 +00:00
|
|
|
end
|
|
|
|
else
|
2021-12-19 02:16:17 +00:00
|
|
|
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(require('navigator.signature').signature_handler, {
|
2022-01-12 09:12:51 +00:00
|
|
|
border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' },
|
2021-10-13 09:27:46 +00:00
|
|
|
})
|
2021-05-17 03:15:15 +00:00
|
|
|
end
|
2021-05-08 04:54:37 +00:00
|
|
|
|
2022-01-12 09:12:51 +00:00
|
|
|
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = single })
|
2021-09-22 14:43:31 +00:00
|
|
|
if cap.document_formatting then
|
2021-12-19 02:16:17 +00:00
|
|
|
log('formatting enabled setup hdl')
|
|
|
|
vim.lsp.handlers['textDocument/formatting'] = require('navigator.formatting').format_hdl
|
2021-09-22 14:43:31 +00:00
|
|
|
end
|
2021-12-19 02:16:17 +00:00
|
|
|
end
|
2021-08-01 13:32:55 +00:00
|
|
|
|
2021-12-19 02:16:17 +00:00
|
|
|
M.get_keymaps_help = function()
|
|
|
|
local ListView = require('guihua.listview')
|
|
|
|
local win = ListView:new({
|
|
|
|
loc = 'top_center',
|
|
|
|
border = 'none',
|
|
|
|
prompt = true,
|
|
|
|
enter = true,
|
2022-01-12 09:12:51 +00:00
|
|
|
rect = { height = 20, width = 90 },
|
|
|
|
data = key_maps_help,
|
2021-12-19 02:16:17 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
return win
|
2021-04-19 02:56:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|