# Refactor/optimize tree-sitter utilities for finding nodes enclosing ranges \(\#37943\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 11b7913956829997a2ce6551e55d6280a173dd55

Requested commit: 11b7913956829997a2ce6551e55d6280a173dd55

Commit: 11b7913956829997a2ce6551e55d6280a173dd55

Tree: 9d1082d0971a8e6f1c7b64b852ed4cd06323f408

Author: Michael Sloan

Committer: GitHub

## Message

```
Refactor/optimize tree-sitter utilities for finding nodes enclosing ranges (#37943)

#35053 split out these utility functions. I found the names / doc
comments a bit confusing so this improves that. Before that PR there was
also a mild inefficiency - it would walk the cursor all the way down to
a leaf and then back up to an ancestor.

Release Notes:

- N/A
```

## Parents

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

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