# Fix enclosing-bracket bug that appeared in JS for loops · gitcafe/zed

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

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

Visibility: public

Requested revision: aeea47323a94bcc69d686632d97f74e7ccb8c1bb

Requested commit: aeea47323a94bcc69d686632d97f74e7ccb8c1bb

Commit: aeea47323a94bcc69d686632d97f74e7ccb8c1bb

Tree: 402a8f4fed91549495ce1a86781b7190bbff7df2

Author: Max Brunsfeld

Committer: Max Brunsfeld

## Message

```
Fix enclosing-bracket bug that appeared in JS for loops

Previously, we were relying on the tree-sitter query's range restriction to
avoid returning brackets that did not contain the given range. But the
query's range restriction only guarantees that we don't descend into parent
nodes unless they intersect the range.

```

## Parents

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

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