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

bug: Several bugs related to re-loading buffer with `:e`

Open tomtomjhj opened this issue 9 months ago • 0 comments

Neovim version (nvim -v)

0.10.4 and nightly

Operating system/version

ubuntu 22.04

Output of :AerialInfo

Aerial Info
-----------
Filetype: markdown
Configured backends:
  treesitter (supported) (attached)
  lsp (not supported) [No LSP client found that supports symbols]
  markdown (supported)
  asciidoc (not supported) [Filetype is not asciidoc]
  man (not supported) [Filetype is not man]
Show symbols: Class, Constructor, Enum, Function, Interface, Module, Method, Struct

Describe the bug

  • Bug 1: on_detach is not called when buffer is reloaded with :e.
  • Bug 2: Symbols are not refreshed when buffer is reloaded with :e.
  • Bug 3: Positions are not refreshed when buffer is reloaded with :e.

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

In all the following examples, use the following config file repro.lua and run nvim with nvim -u repro.lua README.md in the aerial repo.

vim.cmd[[set runtimepath+=.]]
local aerial = require'aerial'
aerial.setup {
  on_attach = function(bufnr)
    vim.keymap.set('n', '[[', aerial.prev, { buffer = bufnr })
    vim.keymap.set('n', ']]', aerial.next, { buffer = bufnr })
  end
}

Bug 1

  1. nvim -u repro.lua README.md
  2. Reload the buffer with :e
  3. Check that [[ and ]] mappings are overwritten by builtin markdown ftplugin. It does move to headings, but it does not highlight them.

Bug 2

  1. nvim -u repro.lua README.md
  2. :e
  3. :lua require'aerial'.next(). Note that it doesn't move the cursor, because aerials BufUnload autocmd clears the bufdata.

Bug 3

  1. nvim -u repro.lua README.md
  2. ]] twice. The cursor is now on the second heading.
  3. :au FileType * lua require('aerial').refetch_symbols()
  4. :e
  5. :lua require'aerial'.next(). This moves the cursor to the first heading, instead of the third heading.

Expected Behavior

see above

Minimal example file

No response

Minimal init.lua


Additional context

No response

tomtomjhj avatar Feb 24 '25 12:02 tomtomjhj