p00f / alabaster.nvim

Neovim port of tonsky's alabaster for Sublime Text. Use https://sr.ht/~p00f/alabaster.nvim instead
MIT License
92 stars 26 forks source link

Errors with nvim-treesitter #15

Open comiluv opened 1 month ago

comiluv commented 1 month ago

Description

:checkhealth nvim-treesitter reports error messages for C# and Zig

Neovim version

v0.10.1

How to reproduce the issue

  1. Use minimal init.lua as below
    
    vim.env.LAZY_STDPATH = ".repro"
    load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({ spec = { { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "csharp", "zig" } }, config = function(, opts) require("nvim-treesitter.configs").setup(opts) end, }, "p00f/alabaster.nvim", }, }) vim.cmd.colorscheme("alabaster")

2. `:checkhealth nvim-treesitter`
3. See error

# Output of `:checkhealth nvim-treesitter`

============================================================================== nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~

OS Info: { machine = "x86_64", release = "10.0.22631", sysname = "Windows_NT", version = "Windows 11 Pro" } ~

Parser/Features H L F I J

The following errors have been detected: ~

comiluv commented 1 month ago

If I do :TSInstall all and then :che nvim-treesitter, report shows 3 errors (out of all 297 parsers)

The following errors have been detected: ~
- ERROR c_sharp(highlights): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 589:2. Invalid node type "record_struct_declaration":
  (record_struct_declaration
   ^

  c_sharp(highlights) is concatenated from the following files:
  |    [OK]:"C:\Users\username\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\c_sharp\highlights.scm"
  | [ERROR]:"C:\Users\username\AppData\Local\nvim-data\lazy\alabaster.nvim\after\queries\c_sharp\highlights.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 12:2. Invalid node type "record_struct_declaration":
  (record_struct_declaration
   ^

- ERROR hare(highlights): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 278:12. Invalid node type "name":
            (name) @AlabasterDefinition))
             ^

  hare(highlights) is concatenated from the following files:
  |    [OK]:"C:\Users\username\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\hare\highlights.scm"
  | [ERROR]:"C:\Users\username\AppData\Local\nvim-data\lazy\alabaster.nvim\after\queries\hare\highlights.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 6:12. Invalid node type "name":
            (name) @AlabasterDefinition))
             ^

- ERROR zig(highlights): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 287:2. Invalid node type "Decl":
  (Decl
   ^

  zig(highlights) is concatenated from the following files:
  |    [OK]:"C:\Users\username\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\zig\highlights.scm"
  | [ERROR]:"C:\Users\username\AppData\Local\nvim-data\lazy\alabaster.nvim\after\queries\zig\highlights.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 4:2. Invalid node type "Decl":
  (Decl
   ^
p00f commented 1 month ago

I don't write C#, @Zorbn can you take a look? I'll update zig

Zorbn commented 1 month ago

It's been a while since I used Neovim but I guess record_struct_declaration just doesn't exist (anymore?) so it can be removed from the highlights file. Maybe all of those C# *_declarations can be replaced with a single type_declaration.

https://github.com/tree-sitter/tree-sitter-c-sharp/blob/fd7f7402db6e66afd70b402fb2e367b2d71c10d6/grammar.js#L250