-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Navigator mess up context #265
Comments
This is my navigaotr config
It's possible that it may over lap with nvimtree-context as well (even though I tried turning off nvim-tree-context and left navigator on but the error still occurred), so here's my nvimtree-context:
|
Still failed to reproduce, here is my init.lua vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/lazy]])
local package_root = '/tmp/nvim/lazy'
local plugin_folder = function()
local host = os.getenv('HOST_NAME')
if host and (host:find('Ray') or host:find('ray')) then
return [[~/github/ray-x]] -- vim.fn.expand("$HOME") .. '/github/'
else
return ''
end
end
local lazypath = package_root .. '/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local function load_plugins()
return {
{
'nvim-treesitter/nvim-treesitter',
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = { 'go' },
highlight = { enable = true },
})
end,
build = ':TSUpdate',
},
{
'nvim-treesitter/nvim-treesitter-context',
config = function()
require('treesitter-context').setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit.
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
default = {
'class',
'function',
'method',
'for',
'while',
'if',
'switch',
'case',
},
-- Patterns for specific filetypes
-- If a pattern is missing, *open a PR* so everyone can benefit.
tex = {
'chapter',
'section',
'subsection',
'subsubsection',
},
rust = {
'impl_item',
'struct',
'enum',
},
scala = {
'object_definition',
},
vhdl = {
'process_statement',
'architecture_body',
'entity_declaration',
},
markdown = {
'section',
},
elixir = {
'anonymous_function',
'arguments',
'block',
'do_block',
'list',
'map',
'tuple',
'quoted_content',
},
json = {
'pair',
},
yaml = {
'block_mapping_pair',
},
},
exact_patterns = {
-- Example for a specific filetype with Lua patterns
-- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will
-- exactly match "impl_item" only)
-- rust = true,
},
-- [!] The options below are exposed but shouldn't require your attention,
-- you can safely ignore them.
zindex = 20, -- The Z-index of the context window
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
})
end,
},
{ 'neovim/nvim-lspconfig' },
{
'ray-x/navigator.lua',
dev = (plugin_folder() ~= ''),
-- '~/github/ray-x/navigator.lua',
dependencies = { 'ray-x/guihua.lua', build = 'cd lua/fzy && make' },
config = function()
require('navigator').setup({
debug = false, -- log output, set to true and log path: ~/.cache/nvim/gh.log
width = 0.75, -- max width ratio (number of cols for the floating window) / (window width)
height = 0.3, -- max list window height, 0.3 by default
preview_height = 0.35, -- max height of preview windows
border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, -- border style, can be one of 'none', 'single', 'double',
-- 'shadow', or a list of chars which defines the border
on_attach = function(client, bufnr)
-- your hook
end,
-- put a on_attach of your own here, e.g
-- function(client, bufnr)
-- -- the on_attach will be called at end of navigator on_attach
-- end,
-- The attach code will apply to all LSP clients
ts_fold = false, -- 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-
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
--[[ 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
--[[ treesitter_analysis_max_num = 100, -- how many items to run treesitter analysis ]]
--[[ treesitter_analysis_condense = true, -- condense form for treesitter analysis ]]
-- this value prevent slow in large projects, e.g. found 100000 reference in a project
transparency = 50, -- 0 ~ 100 blur the main window, 100: fully transparent, 0: opaque, set to nil or 100 to disable it
lsp_signature_help = true, -- if you would like to hook ray-x/lsp_signature plugin in navigator
-- setup here. if it is nil, navigator will not init signature help
signature_help_cfg = nil, -- if you would like to init ray-x/lsp_signature plugin in navigator, and pass in your own config to signature help
icons = {
-- Code action
code_action_icon = '🏏', -- note: need terminal support, for those not support unicode, might crash
-- Diagnostics
diagnostic_head = '🐛',
diagnostic_head_severity_1 = '🈲',
-- refer to lua/navigator.lua for more icons setups
},
lsp = {
enable = true, -- skip lsp setup, and only use treesitter in navigator.
-- Use this if you are not using LSP servers, and only want to enable treesitter support.
-- If you only want to prevent navigator from touching your LSP server configs,
-- use `disable_lsp = "all"` instead.
-- If disabled, make sure add require('navigator.lspclient.mapping').setup({bufnr=bufnr, client=client}) in your
-- own on_attach
code_action = { enable = true, sign = true, sign_priority = 40, virtual_text = true },
code_lens_action = {
enable = true,
sign = true,
sign_priority = 40,
virtual_text = true,
},
document_highlight = true, -- LSP reference highlight,
-- it might already supported by you setup, e.g. LunarVim
format_on_save = false, -- {true|false} set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
-- table: {enable = {'lua', 'go'}, disable = {'javascript', 'typescript'}} to enable/disable specific language
-- enable: a whitelist of language that will be formatted on save
-- disable: a blacklist of language that will not be formatted on save
-- function: function(bufnr) return true end to enable/disable lsp format on save
disable_lsp = { 'all' },
format_options = { async = true }, -- async: disable by default, the option used in vim.lsp.buf.format({async={true|false}, name = 'xxx'})
--[[ disable_format_cap = { "sqls", "sumneko_lua", "gopls" }, -- a list of lsp disable format capacity (e.g. if you using efm or vim-codeformat etc), empty {} by default ]]
-- If you using null-ls and want null-ls format your code
-- you should disable all other lsp and allow only null-ls.
-- disable_lsp = {'pylsd', 'sqlls'}, -- prevents navigator from setting up this list of servers.
-- if you use your own LSP setup, and don't want navigator to setup
-- any LSP server for you, use `disable_lsp = "all"`.
-- you may need to add this to your own on_attach hook:
-- require('navigator.lspclient.mapping').setup({bufnr=bufnr, client=client})
-- for e.g. denols and tsserver you may want to enable one lsp server at a time.
-- default value: {}
diagnostic = {
underline = true,
virtual_text = true, -- show virtual for diagnostic message
update_in_insert = false, -- update diagnostic message in insert mode
},
diagnostic_scrollbar_sign = { '▃', '▆', '█' }, -- experimental: diagnostic status in scroll bar area; set to false to disable the diagnostic sign,
-- for other style, set to {'╍', 'ﮆ'} or {'-', '='}
diagnostic_virtual_text = true, -- show virtual for diagnostic message
diagnostic_update_in_insert = false, -- update diagnostic message in insert mode
disply_diagnostic_qf = false, -- always show quickfix if there are diagnostic errors, set to false if you want to ignore it
tsserver = {
filetypes = { 'typescript' }, -- disable javascript etc,
-- set to {} to disable the lspclient for all filetypes
},
ctags = {
cmd = 'ctags',
tagfile = 'tags',
options = '-R --exclude=.git --exclude=node_modules --exclude=test --exclude=vendor --excmd=number',
},
},
})
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/go.nvim',
dev = (plugin_folder() ~= ''),
-- dev = true,
ft = 'go',
dependencies = {
'mfussenegger/nvim-dap', -- Debug Adapter Protocol
'rcarriga/nvim-dap-ui',
'theHamsta/nvim-dap-virtual-text',
'ray-x/guihua.lua',
},
config = function()
require('go').setup({
verbose = true,
lsp_cfg = {
handlers = {
['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'double' }),
['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{ border = 'round' }
),
},
}, -- false: do nothing
})
end,
},
}
end
local opts = {
root = package_root, -- directory where plugins will be installed
default = { lazy = true },
dev = {
-- directory where you store your local plugin projects
path = plugin_folder(),
},
}
require('lazy').setup(load_plugins(), opts)
vim.cmd('colorscheme murphy') |
I tried to make it minimal but I can't replicate it either. I have quite a bit of plugins so I think |
I got a list of 180+ plugins |
Hi Ray, scratching my head here. I'm trying to replicate this in a minimal file but still can't reproduce it. Here's all my plugins:
I tried to split a big portion of them which I think may caused the issue to a minimal file:
But still couldn't reproduce it. Is there a way we can share session and debug this together? I miss navigator diagnostic functions :'( |
Do you have your init.lua setup in github/gitlab I can clone and test? |
https://github.com/liketoeatcheese/nvimtest I can finally replicate it. I also make a Docker file so you can replicate it if you have docker installed. I also make a video on how I replicate it here. You can view the error popping up around 3:16. Steps to reproduce using docker:
|
What I do is I do <Shift-G> to move to the end and just go up and down the file. It usually happens near where navigator.lua shows diagnostic on hints or issues.
And I use wsl2 on windows 10 if that matters, but I don't think it relates to it tho
|
Recorded a 2min's video with the docker. (you can set the playback speed to 2x) I did not see anything abnormal. Also the packer is lazyloading. Do I need to enable some plugins before the issue showing up? One thing I noticed is the neovim version is 0.8.1 but the current release is 0.8.3 |
So to make sure that it's not a terminal issue, I tested on both windows terminal, and allacrity. Both were tested with the local file system and in a docker container. If you PackerSync everything on In terms of versioning, my local nvim is 0.8.3, and the one in docker is 0.8.1, I built the image using the Dockerfile with apk, assuming alpine's package manager is still a bit behind in nvim versioning. But as it's also showing errors on my local nvim, we can safely say that it's not the version of nvim which caused the issue |
Yea that's right, it's not a permanent duplicate, but just a display issue, when I passed my cursor over the duplicated line, the duplication goes up along with my cursor (As shown in the video). That's very odd that you couldn't replicate it, hmmm. I'm not sure if it's because you're pure Linux and I'm using WSL. |
Could you check if enable |
As it's a global boolean, I did: |
Hi Ray,
I'm seeing context order being messed up, whenever I move the cursor up a line, it duplicates the context showing up above it, like this:
While it should look like this:
It doesn't affect the code itself but it just pops up like that. And if the code is not formatted, and I format it using
<Leader>lf
, it messed up even more. It has been a while since this error show up but wasn't sure which plugin caused it. But today, after I turned off navigator, the issue disappear.Is this a known issues? Any thoughts?
The text was updated successfully, but these errors were encountered: