# Add support for building a Tree-sitter grammar at a given path \(\#9965\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/764e2567557da7c6cf1beeba1462e79cf7260f98)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 764e2567557da7c6cf1beeba1462e79cf7260f98

Requested commit: 764e2567557da7c6cf1beeba1462e79cf7260f98

Commit: 764e2567557da7c6cf1beeba1462e79cf7260f98

Tree: 4ce5f7f65a57d02dd2a8969629162f4a5c56f571

Author: Marshall Bowers

Committer: GitHub

## Message

````
Add support for building a Tree-sitter grammar at a given path (#9965)

This PR extends the extension builder—and by extension, the
`zed-extension` CLI—with support for building a Tree-sitter grammar at a
given path within the grammar repository.

Some Tree-sitter grammar repos contain multiple grammars inside of them.
For instance,
[`tree-sitter-php`](https://github.com/tree-sitter/tree-sitter-php/tree/29838ad107f50b1f5f51a0beefa9c9d834fce2b3)
has subfolders for `php` and `php_only`.

The grammar entries in `extension.toml` can now have an optional `path`
field that will be interpreted relative to the root of the grammar
repository:

```toml
[grammars.php]
repository = "https://github.com/tree-sitter/tree-sitter-php"
commit = "8ab93274065cbaf529ea15c24360cfa3348ec9e4"
path = "php"
```

This was something we supported in the old extension packaging script,
but hadn't yet carried it over when we built the new extension builder.

Release Notes:

- N/A
````

## Parents

- [290f41b97d50f9751dc90c8efb1493d0e31792e2](https://git.cafe/gitcafe/zed/commit/290f41b97d50f9751dc90c8efb1493d0e31792e2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/764e2567557da7c6cf1beeba1462e79cf7260f98?format=markdown)
