Skip to content
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

bug: "AerialOpen float" is always empty, but "left" and "right" work #331

Closed
Hubro opened this issue Dec 1, 2023 · 11 comments
Closed

bug: "AerialOpen float" is always empty, but "left" and "right" work #331

Hubro opened this issue Dec 1, 2023 · 11 comments
Labels
bug Something isn't working P0 Highest priority, will receive attention

Comments

@Hubro
Copy link

Hubro commented Dec 1, 2023

Neovim version (nvim -v)

v0.10.0-dev-d2e7cc6

(Just tested v0.9.4 and it works, so it's specifically an issue with nightly)

Operating system/version

NixOS 23.11

Output of :AerialInfo

Aerial Info
-----------
Filetype: python
Configured backends:
  treesitter (supported) (attached)
  lsp (supported)
  markdown (not supported) [Filetype is not markdown]
Show symbols: Class, Constructor, Enum, Function, Interface, Module, Method, Struct

Describe the bug

AerialOpen left and AerialOpen right always work, but AerialOpen float is always empty:

image

image

The first time I run AerialOpen float in a Neovim session, it shows "Loading", but nothing ever happens:

image

If I reopen it, it's an empty window like above.

Steps To Reproduce

  1. Open any document supported by Aerial
  2. Run :AerialOpen float
  3. See empty floating window, no visible error messages

Expected Behavior

Should have the same content as :AerialOpen left/right

Minimal example file

class Foo:
    def foo():
        pass

    def bar():
        pass

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

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

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.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)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/aerial.nvim",
    config = function()
      require("aerial").setup({
        -- add your aerial config here
      })
    end,
  },
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter.configs").setup({
        ensure_installed = { "c", "lua" },
        auto_install = true,
        highlight = { enable = true },
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Result:

image

Additional context

Tried with and without my Aerial config, didn't make a difference.

:AerialNavOpen works, so the only thing that doesn't work is :AerialOpen float, which is my preferred use case 😄

@Hubro Hubro added the bug Something isn't working label Dec 1, 2023
@stevearc stevearc added the P0 Highest priority, will receive attention label Dec 1, 2023
@Hubro
Copy link
Author

Hubro commented Dec 1, 2023

I just updated my nightly build to v0.10.0-dev-b32b5b2 and it's still broken, but then I tried downloading the official nightly AppImage (v0.10.0-dev-1731+g0bbe8e7fc) and there it works 😕

So it seems to only be broken in my nightly builds from neovim-nightly-overlay for some reason. Very strange. Sorry for the noise!

@Hubro Hubro closed this as completed Dec 1, 2023
@Hubro
Copy link
Author

Hubro commented Jan 19, 2024

Hold on, now it's broken in the nightly appimage too. Demonstration:

Neovim 0.9.4 and 0.9.5:

image

Neovim v0.10.0-dev-2129+gba9f86a9c (nightly appimage):

image

Symptoms are all as initially described.

@Hubro Hubro reopened this Jan 19, 2024
stevearc added a commit that referenced this issue Jan 21, 2024
On Neovim 0.10, calling timer:stop() is not canceling the callback.
There appears to be some minimum amount of buffer time remaining in the
timer in order for it to be able to be canceled correctly. I'm getting
around this by adding a simple guard statement
@stevearc
Copy link
Owner

I found two bugs. One of them was easy to fix, the other one I have filed upstream neovim/neovim#27121

@b0o
Copy link
Contributor

b0o commented Feb 12, 2024

In case it's helpful to anyone, I'm using this workaround until the bug is fixed upstream:

vim.keymap.set('n', '<leader>af', function()
  -- NOTE: Workaround for https://github.com/stevearc/aerial.nvim/issues/331
  require('aerial').refetch_symbols()
  vim.cmd.AerialOpen 'float'
  vim.cmd.doautocmd 'BufWinEnter'
end)

@stevearc
Copy link
Owner

This appears to be fixed upstream now. Can you try it again on the most recent nightly?

@b0o
Copy link
Contributor

b0o commented Mar 13, 2024

This appears to be fixed upstream now. Can you try it again on the most recent nightly?

Works for me now without manually triggering the autocommand, but I still need to do refetch_symbols first or else the symbols might be stale. Not sure if that is the same issue or not.

@stevearc
Copy link
Owner

When you say the symbols might be stale, what problem does this manifest as? Like if you've recently added a symbol it may not be present? Or there won't be any symbols? And is this sporadic or does it happen every time for you?

@b0o
Copy link
Contributor

b0o commented Mar 13, 2024

Like if you've recently added a symbol it may not be present

Yes, after I open Aerial for the first time, the symbols will be correct at first, but won't update as I add/remove them in the buffer until I call refetch_symbols.

And is this sporadic or does it happen every time for you?

Every time.

I just checked my config and switching from backends = { 'lsp', 'treesitter', 'markdown', 'man' } to backends = { 'treesitter', 'lsp', 'markdown', 'man' } seems to have fixed that issue.

@stevearc
Copy link
Owner

Hmmm...this sounds like it might be related to the specific LSP server. Does this happen with other LSP servers? Another thing you can try is setting the config value lsp.diagnostics_trigger_update = false. That should be more reliable about updating your symbols.

Also, does this only happen for :AerialOpen float, or does it also happen for :AerialOpen left?

@b0o
Copy link
Contributor

b0o commented Mar 13, 2024

Does this happen with other LSP servers?

It happens with both tsserver and lua_ls. Not sure about others.

Also, does this only happen for :AerialOpen float, or does it also happen for :AerialOpen left?

It happens with both.

Another thing you can try is setting the config value lsp.diagnostics_trigger_update = false

That works!

@stevearc
Copy link
Owner

If lsp.diagnostics_trigger_update = false fixes the problem, then it's probably just an issue with our interaction with the LSP diagnostics as a trigger to re-fetch symbols. I'll mark this issue as closed now and look into making that config option the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Highest priority, will receive attention
Projects
None yet
Development

No branches or pull requests

3 participants