Bug 56399

Summary: Ошибка нет файла `tree-sitter.json` с ABI 15
Product: Sisyphus Reporter: Таганцева Дина Андреевна <tagantsevada>
Component: tree-sitterAssignee: Владимир Диденко <vladimir.didenko>
Status: CLOSED NOTABUG QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: amakeenk, cow, vladimir.didenko
Version: unstable   
Hardware: x86_64   
OS: Linux   

Description Таганцева Дина Андреевна 2025-10-14 17:38:56 MSK
Ошибка : Warning: No `tree-sitter.json` file found in your grammar, this file is required to generate with ABI 15. Using ABI version 14 instead.

Версия:
tree-sitter-cli-0.25.9-alt1.x86_64

Образы обновленные до Sisyphus:
ALT Workstation 11.1.1 K x86_64
ALT Education 11.0 KDE x86_64
ALT Workstation 11.1  x86_64
ALT Education 11.0 XFCE x86_64

1.Установить пакет # apt-get install tree-sitter-cli nodejs
2.Создать файл конфигурации: $ tree-sitter init-config
3.Создать директорию: $ mkdir -p /home/user/src/tree_sitter/
4.Перейти в tree-sitter:$ cd ~/src/tree_sitter/
5.Выполнить:
$ cat << EOF > grammar.js
module.exports = grammar({
  name: "arithmetic",

  extras: $ => [$.comment, /\s/],

  rules: {
    program: $ => repeat(choice(
      $.assignment_statement,
      $.expression_statement
    )),

    assignment_statement: $ => seq(
      $.variable, "=", $.expression, ";"
    ),

    expression_statement: $ => seq(
      $.expression, ";"
    ),

    expression: $ => choice(
      $.variable,
      $.number,
      prec.left(1, seq($.expression, "+", $.expression)),
      prec.left(1, seq($.expression, "-", $.expression)),
      prec.left(2, seq($.expression, "*", $.expression)),
      prec.left(2, seq($.expression, "/", $.expression)),
      prec.left(3, seq($.expression, "^", $.expression))
    ),

    variable: $ => /\a\w*/,

    number: $ => /\d+/,

    comment: $ => /#.*/
  }
});
EOF
6.4) Выполнить:$ tree-sitter generate && ls

Ожидаемый результат: 
$tree-sitter generate && ls
binding.gyp  bindings  Cargo.toml  grammar.js  Makefile  package.json  Package.swift  pyproject.toml  setup.py  src


Реальный результат: 
$tree-sitter generate && ls
Warning: No `tree-sitter.json` file found in your grammar, this file is required to generate with ABI 15. Using ABI version 14 instead.
This file can be set up with `tree-sitter init`. For more information, see https://tree-sitter.github.io/tree-sitter/cli/init.
 grammar.js 
 
Не воспроизводится в p11 для версии tree-sitter-cli-0.22.6-alt2.x86_64
Comment 1 Владимир Диденко 2025-10-14 20:37:53 MSK
Это не ошибка.

Из release notes для 0.25.0

The internal ABI was bumped to 15. The main benefits this brings is that the language name, version, supertype info, and reserved words are added to the parsers. To use ABI 15, you must have a tree-sitter.json file in your repository, since the version information for the parser is pulled from this file.

Если файла tree-sitter.json нет, то происходит fallback на ABI 14 и генерация происходит по другому. 

Единственное, что я в вашем выводе tree-sitter generate && ls для ABI 14 не вижу папки src - подозреваю, что потерялось при копировании (я воспроизвести не могу).
Comment 2 Alexander Makeenkov 2025-10-15 09:44:42 MSK
(Ответ для Таганцева Дина Андреевна на комментарий #0)
> This file can be set up with `tree-sitter init`.

Решение явно написано же.