nvim-treesitter-context icon indicating copy to clipboard operation
nvim-treesitter-context copied to clipboard

Renders over the statusline

Open JulianNymark opened this issue 6 months ago • 5 comments

Description

status line seems to gets covered by the context at the bottom. Image

Here it is normally (showing the filename)

Image

Would be nice to maybe set a custom offset from top & bottom for where to start rendering the context scope? (this would solve the setup for any users strange setup / status line that might take up N number of lines at either the top or the bottom? 💭

Neovim version

NVIM v0.11.1 Build type: Release LuaJIT 2.1.1744318430

Expected behavior

It should only render the context within the "text area" of the window? (I don't have the correct grammar for the different parts / anatomy of vim/nvim 😅 ). Ignoring headers and or footers (status lines).

Actual behavior

Does render above other elements.

Minimal config

I'll get to this later (currently at work so I don't have time to do it right away, but submitting this so I don't forget about it)

I know this could mean that it's actually a problem with any other plugin / combination of plugins, so until this is done, take the issue with a grain of salt.

Steps to reproduce

I'll get to this later (currently at work so I don't have time to do it right away, but submitting this so I don't forget about it)

I know this could mean that it's actually a problem with any other plugin / combination of plugins, so until this is done, take the issue with a grain of salt.

JulianNymark avatar Jun 03 '25 14:06 JulianNymark

I'm pretty sure contexts aren't drawn at the bottom of the window. Only one window is opened. Are you sure it is this plugin?

lewis6991 avatar Jun 03 '25 14:06 lewis6991

This likely happens because nvim-treesitter-context is implemented using a floating window, and there is nothing that prevents a floating window from covering the statusline.

I can most likely easily patch this if it is of interest @lewis6991

isakbm avatar Jun 10 '25 12:06 isakbm

But the issue report indicates the floating window is at the bottom of the window, which it shouldn't be.

lewis6991 avatar Jun 10 '25 13:06 lewis6991

I think it can happen if the code-buffer-window is not that tall, and if the context-window is allowed to grow very large.

isakbm avatar Jun 11 '25 07:06 isakbm

That's not what the OP indicates in the screenshots. Rather than speculating we need the OP to clarify, otherwise I'll just close this issue.

If you've got fixes you want to make independent of this issue then feel free to raise PR's.

lewis6991 avatar Jun 11 '25 08:06 lewis6991

Turns out that it was a completely different plugin that had this behaviour 😳, sorry for the noise! 🙇

I should not have skipped the minimal config / steps to reproduce.


for those interested, it was an unexpected default of vim-matchup, where it would highlight off-screen matches, and those are easy to confuse with "context" rendering behaviour 😅

to disable it it was:

vim.g.matchup_matchparen_offscreen = {}

on a more meta note, i think i have landed on a pretty good minimal test setup file to make testing future plugins easier 🙌 (still somewhat new to nvim in a way):

-- Don't forget:
-- rm -rf ~/Repos/configs/nvim/.nvim-minimal
-- before new plugin tests!
local root = vim.fn.expand("~/Repos/configs/nvim/.nvim-minimal")

for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local lazypath = root .. "/plugins/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",
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{
		-- some plugin
	},
}, {
	root = root .. "/plugins",
})

No excuse not to simply test any plugin in isolation now 🎉

JulianNymark avatar Oct 15 '25 10:10 JulianNymark