Failed to parse error query - treesitter query uses non-existent statement_list node #24

Open
opened 2026-01-06 09:18:12 -06:00 by guevarez30 · 2 comments
guevarez30 commented 2026-01-06 09:18:12 -06:00 (Migrated from github.com)

Problem:

The error_query in lua/no-go/queries.lua references statement_list which doesn't exist in the current Go treesitter grammar. Statements are directly children of block node .

Error:

no-go.nvim: Failed to parse error query. Try updating the parser with :TSUpdate go

Fix:

Remove statement_list wrapper from the query:

-- Before (broken)

  consequence: (block
    (statement_list
      (return_statement ...)))

-- After (working)

  consequence: (block
    (return_statement ...)
# Problem: The error_query in lua/no-go/queries.lua references statement_list which doesn't exist in the current Go treesitter grammar. Statements are directly children of block node . # Error: ``` no-go.nvim: Failed to parse error query. Try updating the parser with :TSUpdate go ``` # Fix: Remove statement_list wrapper from the query: -- Before (broken) ``` consequence: (block (statement_list (return_statement ...))) ``` -- After (working) ``` consequence: (block (return_statement ...) ```
guevarez30 commented 2026-01-06 09:22:11 -06:00 (Migrated from github.com)

Would like to contribute, or here is the solution.

File: lua/no-go/queries.lua

Replace this:

  M.error_query = [[
  (
    (if_statement
      condition: (binary_expression
        left: (identifier) @err_identifier)
      consequence: (block
        (statement_list
          (return_statement
            (expression_list
              (identifier) @return_identifier)?)))) @collapse_block) @if_statement
  ]]

With this:

  M.error_query = [[
  (if_statement
    condition: (binary_expression
      left: (identifier) @err_identifier)
    consequence: (block
      (return_statement
        (expression_list
          (identifier) @return_identifier)?)) @collapse_block) @if_statement
  ]]

Changes:

  1. Removed outer ( wrapper and extra indentation
  2. Removed (statement_list ...) wrapper - return_statement is now directly inside block
  3. Adjusted closing parentheses accordingly
Would like to contribute, or here is the solution. **File**: lua/no-go/queries.lua **Replace this:** ```lua M.error_query = [[ ( (if_statement condition: (binary_expression left: (identifier) @err_identifier) consequence: (block (statement_list (return_statement (expression_list (identifier) @return_identifier)?)))) @collapse_block) @if_statement ]] ``` With this: ```lua M.error_query = [[ (if_statement condition: (binary_expression left: (identifier) @err_identifier) consequence: (block (return_statement (expression_list (identifier) @return_identifier)?)) @collapse_block) @if_statement ]] ``` **Changes**: 1. Removed outer ( wrapper and extra indentation 2. Removed (statement_list ...) wrapper - return_statement is now directly inside block 3. Adjusted closing parentheses accordingly
Owner

Hello! Thanks for opening the ticket and the PR. I have to say, I have no experienced this issue. Are you on the treesitter main or master branch? This has been discussed prior: https://github.com/TheNoeTrevino/no-go.nvim/issues/7

If you are on the main branch, and have an up to date parser, could you please send me a test file to reproduce?

Thanks

Hello! Thanks for opening the ticket and the PR. I have to say, I have no experienced this issue. Are you on the treesitter main or master branch? This has been discussed prior: https://github.com/TheNoeTrevino/no-go.nvim/issues/7 If you are on the main branch, and have an up to date parser, could you please send me a test file to reproduce? Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
noe.trevino/no-go.nvim#24
No description provided.