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

lazy loading #173

Closed
mathjiajia opened this issue Oct 27, 2022 · 3 comments
Closed

lazy loading #173

mathjiajia opened this issue Oct 27, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mathjiajia
Copy link

Describe the bug
When using lazy loading (by default),
aerial will not fallback to lsp if treesitter is not support.

System information

  • OS: [mac]
  • Neovim version: NVIM v0.9.0-dev-169+gfef8ff908
  • AerialInfo: [
    Filetype: tex
    Configured backends:
    treesitter (not supported) [No query file for 'latex']
    lsp (not supported) [LSP client available, but not attached]
    markdown (not supported) [Filetype is not markdown]
    man (not supported) [Filetype is not man]
    Show symbols: Class, Constant, Constructor, Enum, EnumMember, Function, Interface, Method, Module, Object, Struct, Variable]
  • Aerial config:
require('aerial').setup({
	filter_kind = {
		'Class', 'Constant', 'Constructor', 'Enum',
		'EnumMember', 'Function', 'Interface', 'Method',
		'Module', 'Object', 'Struct', 'Variable',
	},
	-- lazy_load = false,
	show_guides = true,
})

To Reproduce
Steps to reproduce the behavior:

  1. Open a file that haven't been supported by treesitter, say tex
  2. Use AerialToggle

If possible, provide a minimal file that will trigger the issue:

minimal code here

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot 2022-10-27 at 8 27 30 AM

Additional context
Maybe you can call create_autocmds() in the lazy mode??

@mathjiajia mathjiajia added the bug Something isn't working label Oct 27, 2022
@rebelot
Copy link

rebelot commented Oct 27, 2022

To me, aerial does not attach to lsp if lazy_mode is true, unless I reload the buffer.

this is my workaround

    use({
        "stevearc/aerial.nvim",
        event = "BufRead",
        cmd = { "AerialToggle", "AerialInfo" },
        keys = { { "n", "<leader>at" } },
        config = function()
            require("aerial").setup({
                lazy_load = false,
                ...
            })
        end
    })

@stevearc
Copy link
Owner

This was because we were relying too much on the LspAttach autocmd, and that isn't set up when aerial is in lazy (pending loading) mode. I've refactored it to not lean so much on the autocmd, and it should be fixed now.

@mathjiajia
Copy link
Author

It resolves this problem.
Thank you.

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

No branches or pull requests

3 participants