{"id":20658060,"url":"https://github.com/cursorless-dev/vscode-parse-tree","last_synced_at":"2025-04-19T20:27:17.733Z","repository":{"id":37703010,"uuid":"359752088","full_name":"cursorless-dev/vscode-parse-tree","owner":"cursorless-dev","description":"Syntax trees for VSCode using tree-sitter","archived":false,"fork":false,"pushed_at":"2024-07-22T14:15:51.000Z","size":7192,"stargazers_count":41,"open_issues_count":12,"forks_count":35,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-07-22T17:09:07.337Z","etag":null,"topics":["parser","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cursorless-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["pokey","AndreasArvidsson"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":"pokey","issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-04-20T09:06:42.000Z","updated_at":"2024-07-22T14:15:54.000Z","dependencies_parsed_at":"2023-11-14T20:26:45.104Z","dependency_job_id":"1766b069-504d-47e7-8f15-b98aba5f195e","html_url":"https://github.com/cursorless-dev/vscode-parse-tree","commit_stats":null,"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cursorless-dev%2Fvscode-parse-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cursorless-dev%2Fvscode-parse-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cursorless-dev%2Fvscode-parse-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cursorless-dev%2Fvscode-parse-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cursorless-dev","download_url":"https://codeload.github.com/cursorless-dev/vscode-parse-tree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249793950,"owners_count":21326638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parser","vscode-extension"],"created_at":"2024-11-16T18:24:37.607Z","updated_at":"2025-04-19T20:27:17.712Z","avatar_url":"https://github.com/cursorless-dev.png","language":"TypeScript","readme":"# Parse tree\n\nExposes an api function that can be used to get a parse tree node for a given file location.\n\n## Usage\n\nCan be used as follows:\n\n```ts\nconst parseTreeExtension = vscode.extensions.getExtension(\"pokey.parse-tree\");\n\nif (parseTreeExtension == null) {\n  throw new Error(\"Depends on pokey.parse-tree extension\");\n}\n\nconst { getNodeAtLocation } = await parseTreeExtension.activate();\n```\n\nDon't forget to add an `extensionDependencies`-entry to `package.json` as\ndescribed in\nhttps://code.visualstudio.com/api/references/vscode-api#extensions.\n\n### Parsing a custom language\n\nIf you'd like to add support for a new language, see the [Adding a new language](#adding-a-new-language) section below. Alternatively, your extension can register a custom language with this extension. Although this is not the preferred way to add a new language, it can be convenient when you have a parser that you don't believe belongs in the main extension.\n\nParsing your own language is as simple as registering your `languageId` with an absolute path to your `.wasm` file:\n\n```ts\nconst { registerLanguage } = await parseTreeExtension.activate();\n\nregisterLanguage(languageId, wasmPath);\n```\n\n## Contributing\n\n### Setup\n\n1. `yarn`\n2. Install [emscripten](https://emscripten.org/docs/getting_started/downloads.html) for generating parser wasm files\n\n### Adding a new language\n\nIt's straightforward to add any [language with a tree-sitter grammar](https://tree-sitter.github.io/tree-sitter/).\n\n1. Add a dependency on the npm package for that language: `yarn add -D tree-sitter-yourlang`.\n2. Add a language to the dictionary at the top of `./src/extension.ts`\n3. Add a reference to `onLanguage:yourlang` to the [activationEvents section of package.json](package.json). `yourlang` must be a [VSCode language identifier](https://code.visualstudio.com/docs/languages/identifiers).\n4. Add your language to the top of the [Makefile](Makefile)\n5. Run `yarn compile`, then hit `F5` in VSCode, with this project open, to test your changes.\n6. Submit a PR!\n\n### Developing on WSL2\n\nWhen working with WSL, the host vscode instance connects to a vscode server on the WSL vm. This happens automatically when you run \"code\" in WSL, as long as you have the \"Remote - WSL\" extension installed on the host. From there you need to:\n\n- Install the `pokey.command-server` extension on the host vscode\n- Clone the extension in the WSL side.\n- If you're adding language support to `vscode-parse-tree`, you need to clone that as well, build it, and link it into the `vscode-server` extension folder: `ln -s ~/your/code/vscode-parse-tree ~/.vscode-server/extensions/parse-tree` for instance.\n- If you get errors about needing to install the `Remote-WSL` extension, you might need to manually delete the extension from the host side and try again.\n\n## Change Log\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n# Credits\n\nForked from https://github.com/georgewfraser/vscode-tree-sitter.\n","funding_links":["https://github.com/sponsors/pokey","https://github.com/sponsors/AndreasArvidsson","https://liberapay.com/pokey"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcursorless-dev%2Fvscode-parse-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcursorless-dev%2Fvscode-parse-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcursorless-dev%2Fvscode-parse-tree/lists"}