folke / noice.nvim

💥 Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu.
Apache License 2.0
4.18k stars 95 forks source link

bug: window offsets applies to the bottom of the window when the window appears above the cursor #592

Open ofseed opened 12 months ago

ofseed commented 12 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0-dev-bb38c06

Operating system/version

Arch Linux

Describe the bug

Noice adds offsets when enabling border for LSP docs so that the window will not cover the current line:

image

But if the floating window is above the cursor, the offsets apply to the bottom of the window, and there will be a gap between the window and the cursor

image

Steps To Reproduce

  1. Enable LSP (by nvim-lspconfig)
  2. call vim.lsp.buf.hover()

Expected Behavior

The original vim.lsp.util.open_floating_preview do not have this problem.

image

Repro

vim.o.number = true

local root = vim.fn.fnamemodify("./.repro", ":p")

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

local lazypath = vim.fs.joinpath(root, "lazy.nvim")
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

require("lazy").setup {
  "folke/tokyonight.nvim",
  {
    "folke/noice.nvim",
    dependencies = {
      "MunifTanjim/nui.nvim",
      "rcarriga/nvim-notify",
    },
    opts = {
      presets = {
        lsp_doc_border = true,
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    config = function()
      require("lspconfig").lua_ls.setup {}
    end,
  },
}

vim.cmd.colorscheme "tokyonight"
github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

ofseed commented 2 months ago

This issue still exits.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

ofseed commented 1 month ago

This issue still exits.

github-actions[bot] commented 1 day ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

ofseed commented 1 day ago

This issue still exits.