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

invalid node type at position error #2

Closed
captalbator opened this issue May 9, 2023 · 6 comments
Closed

invalid node type at position error #2

captalbator opened this issue May 9, 2023 · 6 comments

Comments

@captalbator
Copy link

I updated the queries and everything broke with the common error being invalid node type at position X for language luau

I have followed every step described by the nvim-treesitter team here: nvim-treesitter/nvim-treesitter#3092

yet the issue still persists.

NVIM version: 0.9.0
OS: Windows 10

Config:

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()

parser_config.luau = {
	install_info = {
		url = "https://github.com/polychromatist/tree-sitter-luau",
		files = { "src/parser.c", "src/scanner.c" },
		branch = "main",
		-- If I don't specify the revision it throws an error: `fatal: reference is not a tree`
		revision = "48135f8b89f623163c5e0610c2d4661cd82bcd28",
		generate_requires_npm = false,
		requires_generate_from_grammar = false,
	},
	filetype = "luau",
}

checkhealth nvim-treesitter:

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

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v19.5.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc.exe (Rev2, Built by MSYS2 project) 12.1.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

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

Parser/Features         H L F I J
  - c                   ✓ ✓ ✓ ✓ ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - luau                x x x x x
  - markdown            ✓ . ✓ . ✓
  - markdown_inline     ✓ . . . ✓
  - odin                ✓ ✓ . ✓ .
  - rust                ✓ ✓ ✓ ✓ ✓
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - yaml                ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

The following errors have been detected: ~
- ERROR luau(highlights): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 12 for language luau
  luau(highlights) is concatenated from the following files:
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\luau\highlights.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 12 for language luau
- ERROR luau(locals): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 25 for language luau
  luau(locals) is concatenated from the following files:
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\luau\locals.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 25 for language luau
- ERROR luau(folds): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 4 for language luau
  luau(folds) is concatenated from the following files:
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\lua\folds.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 4 for language luau
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\luau\folds.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 22 for language luau
- ERROR luau(indents): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 5 for language luau
  luau(indents) is concatenated from the following files:
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\lua\indents.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 5 for language luau
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\luau\indents.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 22 for language luau
- ERROR luau(injections): .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 2 for language luau
  luau(injections) is concatenated from the following files:
  | [ERROR]:"C:\Users\antoi\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\luau\injections.scm", failed to load: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 2 for language luau
@captalbator
Copy link
Author

The issue doesn't happen on my linux setup, so it's probably something with my windows setup messing with treesitter. Closing as this seems to be an issue on my side.

@captalbator
Copy link
Author

captalbator commented May 9, 2023

Nevermind! It's also happening on my linux setup.

@captalbator captalbator reopened this May 9, 2023
@captalbator
Copy link
Author

An interesting note is that the tarball downloaded by tree-sitter is empty, and if I force it to use git it gives me:

nvim-treesitter[luau]: Error while checking out revision
fatal: reference is not a tree: 4f8fc207b3a25b07cba1d3b4066f2872dcfe201f

@captalbator
Copy link
Author

Okay. This is on me. Luau was recently added to treesitter and the parsers are different. Simply using treesitter's version fixed the issue.

@polychromatist
Copy link
Owner

Indeed, it looks like @amaanq added a luau parser to nvim-treesitter.

nvim-treesitter/nvim-treesitter@cde3068

I use Luau daily, so I maintain my own. Sorry to cause confusion, I'll add a notice to the readme.

@captalbator
Copy link
Author

No worries, this isn't on you. I should've checked the moment I got the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants