nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.43k stars 285 forks source link

"No information available" when calling hover_doc #1295

Open diegoulloao opened 11 months ago

diegoulloao commented 11 months ago

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

glepnir commented 11 months ago

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

diegoulloao commented 11 months ago

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

I'll check kitty, thanks for the recommendation.

glepnir commented 11 months ago

tailwindcss and emmet also attach this buffer right ?

diegoulloao commented 11 months ago

that's correct, sorry I missed those

glepnir commented 11 months ago

Lspsaga hover_doc ++silent

diegoulloao commented 11 months ago

Lspsaga hover_doc ++silent

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

glepnir commented 11 months ago

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

ls-devs commented 10 months ago

@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

glepnir commented 10 months ago

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

ls-devs commented 10 months ago

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.

glepnir commented 10 months ago

I will try it later.

ls-devs commented 10 months ago

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,
},
rbereziuk commented 10 months ago

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

jasonpanosso commented 10 months ago

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.

diegoulloao commented 10 months ago

@glepnir I think you should reopen this issue.

diegoulloao commented 9 months ago

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 },
    },
  },
})
binhtran432k commented 4 months ago

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" })
farzadmf commented 3 months ago

This is still happening in nvim 0.10.0 🙁