I tried completely different approach to my problem:
(我尝试了完全不同的方法来解决我的问题:)
I generated Tree-sitter parser as an Atom package, therefore it is set in "node environment" used by Atom editor not mine (I hope I understand the problem correctly).
(我将Tree-sitter解析器作为Atom软件包生成,因此它是在Atom编辑器使用的“节点环境”中设置的,而不是我的(我希望我正确理解了这个问题)。)
I just added grammar.js file to the package and then followed the tree-sitter guide I linked in my question (only without nmp init - I preserved package.json generated by Atom package generate). (我只是将grammar.js文件添加到程序包中,然后按照我在问题中链接的tree-sitter指南进行操作(仅不使用nmp init-我保留了由Atom程序包generate生成的package.json )。)
Then I created my language package as in the Atom grammar tutorial I included in my post.I added dependency for my parser and also ran npm link in parser directory and npm link PARSER_PACKAGE_NAME and npm i in the package directory. (然后,我建立了我的语言包是在Atom语法教程中,我包括在我post.I添加依赖我的解析器和也跑解析器目录和NPM链接PARSER_PACKAGE_NAME NPM链接和NPM我包目录。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…