Closed bokunodev closed 5 months ago
Some of the info you're looking for is here in the README: https://github.com/sublime-treesitter/TreeSitter?tab=readme-ov-file#manage-your-own-language-repos-and-binaries
To manage your own languages, you need to do a few things in the STS settings. Search for Preferences: TreeSitter Settings
in the command palette
python_path
to an external Python 3.8 executable with a working C compiler. This way STS can compile its own TS language binaries. The Python that ships with Sublime Text can't compile TS languageslanguage_name_to_repo
to your settings, and also add language_name_to_scopes
src/utils.py
language_name_to_scopes
grammar.js
filesHere's an example of how to do this for e.g. dart
Your settings would look something like this. Then you could run TreeSitter: Install Language
and install dart
. STS would download the language repo, build the language binary, instantiate the language, and use it to parse code in any buffer with a scope of source.dart
{
"python_path": "~/.pyenv/versions/3.8.13/bin/python",
"installed_languages": [
"python",
"json",
],
"language_name_to_repo": {
"dart": {"repo": "UserNobody14/tree-sitter-dart"},
},
"language_name_to_scopes": {
"dart": [
"source.dart",
],
},
}
how to add new grammar that isn't listed in the menu? where should i put
grammar.js
and the parser files?