Bug 56399 - Ошибка нет файла `tree-sitter.json` с ABI 15
Summary: Ошибка нет файла `tree-sitter.json` с ABI 15
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: tree-sitter (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Владимир Диденко
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-14 17:38 MSK by Таганцева Дина Андреевна
Modified: 2025-10-15 09:44 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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`.

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