stevearc / aerial.nvim

Neovim plugin for a code outline window
MIT License
1.55k stars 76 forks source link

bug: `julia` treesitter queries broken after latest `nvim-treesitter` update #361

Closed mehalter closed 2 months ago

mehalter commented 2 months ago

Neovim version (nvim -v)

0.9.5 release

Operating system/version

Arch Linux

Output of :AerialInfo

Unable to run without getting error.

Error executing vim.schedule lua callback: .../nightly/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 18:2. Invalid node type "short_function_definition":
(short_function_definition
 ^

stack traceback:
    [C]: in function '_ts_parse_query'
    .../nightly/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
    ...vim/nightly/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
    ...vim/nightly/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'load_query'
    ...y/aerial.nvim/lua/aerial/backends/treesitter/helpers.lua:65: in function 'get_query'
    ...lazy/aerial.nvim/lua/aerial/backends/treesitter/init.lua:22: in function 'is_supported'
    ...share/nvim/lazy/aerial.nvim/lua/aerial/backends/init.lua:40: in function 'is_supported'
    ...share/nvim/lazy/aerial.nvim/lua/aerial/backends/init.lua:73: in function 'get_best_backend'
    ...share/nvim/lazy/aerial.nvim/lua/aerial/backends/init.lua:147: in function 'get'
    ...share/nvim/lazy/aerial.nvim/lua/aerial/backends/init.lua:251: in function 'attach'
    .../share/nvim/lazy/aerial.nvim/lua/aerial/autocommands.lua:88: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

Describe the bug

New Julia treesitter queries breaking changes: https://github.com/nvim-treesitter/nvim-treesitter/pull/6429

The Julia treesitter parser got a huge refactor that included some breaking changes with how parameters and things are represented. This breaks the current Julia queries in Aerial.

What is the severity of this bug?

blocking (cannot use plugin)

Steps To Reproduce

  1. nvim -u repro.lua test.jl, open a Julia file (no code necessary, this can even be a new/empty Julia file)

Expected Behavior

No error and symbols detection should work.

Minimal example file

No response

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", "julia" },
        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

No response