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: golang missing variables, constants, fields if functions or structs are enabled #345

Open
0xmycf opened this issue Feb 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@0xmycf
Copy link

0xmycf commented Feb 16, 2024

Neovim version (nvim -v)

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

Operating system/version

MacOS 12.1

Output of :AerialInfo

Aerial Info

Filetype: go
Configured backends:
treesitter (supported)
lsp (supported)
markdown (not supported) [Filetype is not markdown]
man (not supported) [Filetype is not man]
Show symbols: Function, Method, Struct, Field, Variable, Constant

Describe the bug

This bug is related to this setting in the config:

  filter_kind = {
    "Function",
    "Method",
    "Struct",
    "Field",
    "Variable",
    "Constant",
  },

It displays this for those settings:
screenshot

And if I disable method, function and struct:
screenshot

I used this file to test it: https://gist.github.com/0xmycf/aa44b2f94db1bcf90d630666dea816ad

I would expect that it shows the fields, variables and constants also when method function and struct is enabled.
I have no tested this for Enum or other kinds. This also happens for filter_kind = false

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

  1. Get a go file like the one I used
  2. install and load aerial, configure it with
 filter_kind = {
    "Field",
    "Variable",
    "Constant",
    "Function",
    "Method",
    "Struct",
  },
  1. Open the go file and toggle aerial, see what things are listed
  2. Comment out Function, Method and Struct (or any combination)
  3. reload the vim config / exit re-enter vim with the go file
  4. Toggle aerial and see what things are listed

Expected Behavior

There is no difference between

 filter_kind = {
    "Field",
    "Variable",
    "Constant",
    "Function",
    "Method",
    "Struct",
  },

and

 filter_kind = {
    "Field",
    "Variable",
    "Constant",
  },

besides more or less fields.

Minimal example file

-- Call the setup function to change the default behavior
require("aerial").setup {
  backends = { "treesitter", "lsp", "markdown", "man" },
  layout = {
    max_width = { 120, 0.6 },
    default_direction = "prefer_right",
    placement = "edge",
  },
  filter_kind = {
    "Field",
    "Variable",
    "Constant",
    "Function",
    "Method",
    "Struct",
  },
}

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

Additional context

Edit: also type newtype strc is not recognized as a struct.

@0xmycf 0xmycf added the bug Something isn't working label Feb 16, 2024
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

1 participant