update doc; improve hover as some LSP does not support hover/signature; ctag default tagfile checking

neovim_0.9
ray-x 1 month ago
parent 65df819a66
commit 736cba15dc

@ -272,12 +272,12 @@ require'navigator'.setup({
max_lines_scan_comments = 20, -- only fold when the fold level higher than this value
disable_filetypes = {'help', 'guihua', 'text'}, -- list of filetypes which doesn't fold using treesitter
}, -- modified version of treesitter folding
default_mapping = true, -- set to false if you will remap every key or if you using old version of nvim-
default_mapping = true, -- set to false if you will remap every key
keymaps = {{key = "gK", func = vim.lsp.declaration, desc = 'declaration'}}, -- a list of key maps
-- this kepmap gK will override "gD" mapping function declaration() in default kepmap
-- please check mapping.lua for all keymaps
-- rule of overriding: if func and mode ('n' by default) is same
-- it can be overrided
-- the key will be overridden
treesitter_analysis = true, -- treesitter variable context
treesitter_navigation = true, -- bool|table false: use lsp to navigate between symbol ']r/[r', table: a list of
--lang using TS navigation

@ -94,9 +94,16 @@ local function ctags_symbols()
width = math.floor(vim.api.nvim_get_option('columns') * width)
local items = {}
local ctags_file = _NgConfigValues.ctags.tagfile
-- the tagfile name can be either .tags or tags
if vim.fn.filereadable(ctags_file) == 0 then
if vim.fn.filereadable('tags') == 1 then -- for some config the default tagfile is tags
ctags_file = 'tags'
_NgConfigValues.ctags.tagfile = 'tags'
end
end
if not util.file_exists(ctags_file) then
ctags_gen()
vim.cmd('sleep 200m')
vim.cmd('sleep 400m')
end
local cnts = util.io_read(ctags_file)
if cnts == nil then

@ -5,21 +5,20 @@ local api = vim.api
local log = nutils.log
local M = {}
function M.handler(_, result, ctx, config)
function M.handler(err, result, ctx, config)
config = config or {}
config.focus_id = ctx.method
if err then
return vim.notify('no hover info ' .. err)
end
if api.nvim_get_current_buf() ~= ctx.bufnr then
-- Ignore result since buffer changed. This happens for slow language servers.
return
end
if not (result and result.contents) then
if config.silent ~= true then
vim.notify('No information available')
vim.notify('No hover information available')
end
vim.schedule(function()
-- fallback to signature help
vim.lsp.buf.signature_help()
end)
return
end
local format = 'markdown'

@ -4,19 +4,17 @@ local os_name = uv.os_uname().sysname
local is_windows = os_name == 'Windows' or os_name == 'Windows_NT'
local package_root = '/tmp/nvim/lazy'
local sep = '/'
if is_windows then
local tmp = os.getenv('TEMP')
vim.cmd("set packpath=" .. tmp .. "\\nvim\\lazy")
vim.cmd('set packpath=' .. tmp .. '\\nvim\\lazy')
package_root = tmp .. '\\nvim\\lazy'
sep = '\\'
else
vim.cmd([[set packpath=/tmp/nvim/lazy]])
end
local plugin_folder = function()
local host = os.getenv('HOST_NAME')
if host and (host:find('Ray') or host:find('ray')) then
@ -51,19 +49,19 @@ local function load_plugins()
build = ':TSUpdate',
},
{ 'neovim/nvim-lspconfig' },
{
'simrat39/rust-tools.nvim',
config = function()
require('rust-tools').setup({
server = {
on_attach = function(client, bufnr)
require('navigator.lspclient.mapping').setup({ client = client, bufnr = bufnr }) -- setup navigator keymaps here,
-- otherwise, you can define your own commands to call navigator functions
end,
},
})
end,
},
-- {
-- 'simrat39/rust-tools.nvim',
-- config = function()
-- require('rust-tools').setup({
-- server = {
-- on_attach = function(client, bufnr)
-- require('navigator.lspclient.mapping').setup({ client = client, bufnr = bufnr }) -- setup navigator keymaps here,
-- -- otherwise, you can define your own commands to call navigator functions
-- end,
-- },
-- })
-- end,
-- },
{ 'ray-x/lsp_signature.nvim', dev = (plugin_folder() ~= '') },
{
'ray-x/navigator.lua',
@ -72,6 +70,13 @@ local function load_plugins()
dependencies = { 'ray-x/guihua.lua', build = 'cd lua/fzy && make' },
config = function()
require('navigator').setup({
keymaps = {
{
key = '<Leader>rn',
func = require('navigator.rename').rename,
desc = 'rename',
},
},
lsp = {
-- disable_lsp = { 'rust_analyzer', 'clangd' },
},
@ -84,10 +89,10 @@ local function load_plugins()
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
},
config = function ()
config = function()
-- Add additional capabilities supported by nvim-cmp
local cmp = require 'cmp'
cmp.setup {
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
@ -98,14 +103,15 @@ local function load_plugins()
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},}),
}),
}),
sources = {
{ name = 'nvim_lsp' },
},
}
})
end,
},
{

Loading…
Cancel
Save