lspsaga.nvim icon indicating copy to clipboard operation
lspsaga.nvim copied to clipboard

"No information available" when calling hover_doc

Open diegoulloao opened this issue 1 year ago • 19 comments

Describe the bug

Is supposed that using the ++quiet mode the notification saying "No information available" should disappear, but it doesn't. I don't know if is only happening to me.

keymap.set("n", "<leader>K", "<cmd>Lspsaga hover_doc ++quiet<CR>", opts) -- show documentation for the cursor

I'm using the last published version.

This is related to #1015.

Screen capture Screenshot

Steps to reproduce

  1. Open a react typescript file
  2. Call Lspsaga hover_doc ++quiet over the component name (which is typed properly).

Expected behavior

Do not see any notification or message saying "No information available", just see the hover_doc floating box.

Neovim version (nvim -v)

NVIM v0.9.1 Build type: Release LuaJIT 2.1.0-beta3

lspsaga commit

5fa17a8

Terminal name/version

iTerm2 build 3.4.20

diegoulloao avatar Sep 26 '23 05:09 diegoulloao

hmm which servers you used on this buffer. and btw kitty better than iterm2 :+1:

glepnir avatar Sep 26 '23 07:09 glepnir

@glepnir using tsserver -> https://github.com/diegoulloao/nvim-diegoulloao/blob/91a5761a0ea83fad24d0951d2ba47d8317d1403a/plugins/lsp/lspconfig.lua#L69

I'll check kitty, thanks for the recommendation.

diegoulloao avatar Sep 26 '23 08:09 diegoulloao

tailwindcss and emmet also attach this buffer right ?

glepnir avatar Sep 26 '23 08:09 glepnir

that's correct, sorry I missed those

diegoulloao avatar Sep 26 '23 08:09 diegoulloao

Lspsaga hover_doc ++silent

glepnir avatar Sep 26 '23 11:09 glepnir

Lspsaga hover_doc ++silent

it doesn't work, same issue, actually I already tried ++silent before

diegoulloao avatar Sep 26 '23 19:09 diegoulloao

I can't reproduce with ++silent that's wired

glepnir avatar Sep 27 '23 06:09 glepnir

@glepnir I can reproduce with ++silent The only things that changed in my configuration was the switch from lsp-zero v2 to lsp-zero v3.

Actually the only workaround I found was to switch from

Lspsaga hover_doc

To basic neovim lsp hover

vim.lsp.buf.hover()

To avoid being spammed by No information available notifications.

Even with this configuration of the handlers :

  vim.lsp.handlers["textDocument/hover"] = function(_, result, ctx, config)
    config = config or {}
    config.focus_id = ctx.method
    if not (result and result.contents) then
      return
    end
    config.border = "rounded"
    local markdown_lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
    markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)
    if vim.tbl_isempty(markdown_lines) then
      return
    end
    return vim.lsp.util.open_floating_preview(markdown_lines, "markdown", config)
  end
end

I still got the No information available notifications, only with lspsaga

ls-devs avatar Oct 24 '23 13:10 ls-devs

I can't reproduce and which language servers in which file?

glepnir avatar Oct 25 '23 00:10 glepnir

I can't reproduce and which language servers in which file?

@glepnir

List of language servers : Capture d’écran 2023-10-25 à 09 29 56

File is a .tsx

Please see.: Capture d’écran 2023-10-25 à 09 31 04

Command used :

Lspsaga hover_doc ++silent

I don't have any steps for you to reproduce, all that I can give is my neovim configuration if you want to try it by yourself, you can find it here : ls-devs/nvim

Other thing, I'm not sure I have to post it here since it's another issue, but when requesting a hover on a tailwind class, I first have the window opening (still with the notification No information available indeed). But if I request another hover I have this notification : [lspsaga] a hover request has already been sent, please wait. and can't request hover anymore. The only way for me to have the hover working again is to quit neovim and restarting it.

ls-devs avatar Oct 25 '23 07:10 ls-devs

I will try it later.

glepnir avatar Oct 25 '23 07:10 glepnir

I will try it later.

Thanks. FYI, you can find the list of keymaps in the file legendary.lua. Leader key is <Space>

If you want informations on keybinds, kind of which-key does, you can use <leader>LK

Actual keybind for Lspsaga hover_doc ++silent is :

{
	"<leader>K",
	"<cmd>Lspsaga hover_doc ++silent<CR>",
	description = "LSPSaga Hover Doc",
	opts = opts,
},

ls-devs avatar Oct 25 '23 08:10 ls-devs

Hi @glepnir Face this issue today Screenshot from 2023-11-03 22-29-37 Screenshot from 2023-11-03 22-30-51

NVIM v0.9.2 Build type: Release LuaJIT 2.1.1694285958

I tried quite and silent, but nothing helped

rbereziuk avatar Nov 03 '23 20:11 rbereziuk

But if I request another hover I have this notification : [lspsaga] a hover request has already been sent, please wait. and can't request hover anymore. The only way for me to have the hover working again is to quit neovim and restarting it.

I'm having this same issue, but it arises after trying hover_doc on something "invalid", like await, const, etc in typescript. If I ever try to request documentation on things of that sort, then I have to restart neovim in order to see documentation again.

This doesn't occur in other languages(from what I can tell), and the only lsp I have attached is tsserver.

jasonpanosso avatar Nov 14 '23 15:11 jasonpanosso

@glepnir I think you should reopen this issue.

diegoulloao avatar Nov 14 '23 16:11 diegoulloao

If you are using noice with the notify integration, a temporary fix is:

noice.setup({
  -- filters
  routes = {
    {
      -- avoid annoying message
      filter = {
        event = "notify",
        find = "No information available",
      },
      opts = { skip = true },
    },
  },
})

diegoulloao avatar Nov 26 '23 02:11 diegoulloao

For anybody come here from Google, this is my solution from my config:

vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(function(_nil, result, ctx, config)
  if result then
    return vim.lsp.handlers.hover(_nil, result, ctx, config)
  end
end, { border = "rounded" })

binhtran432k avatar May 01 '24 13:05 binhtran432k

This is still happening in nvim 0.10.0 🙁

farzadmf avatar May 23 '24 02:05 farzadmf