Skip to content

export tree sitter's id field#28

Merged
mattmassicotte merged 2 commits into
tree-sitter:mainfrom
lijunsong:main
Jun 5, 2024
Merged

export tree sitter's id field#28
mattmassicotte merged 2 commits into
tree-sitter:mainfrom
lijunsong:main

Conversation

@lijunsong
Copy link
Copy Markdown
Contributor

This PR exports the underlying tree_node's id field as UInt.

There were two choices to make: one is to export the id, the other is to make a Node hashable based on the id. Investigation shows it's the least confusion solution to export the id field. Details see #26

lijunsong added 2 commits May 21, 2024 09:33
Making Node hashable is tricky. As the node equality depends on
not only node id, but also node's tree. After parsing, the id can
stay the same but the tree can change, so even if the node is hashable
based on its id, fetching a value from a directory of type [Node:Any]
can lead to surprising missing values.

So the best way so far to id a Node is to export the id field, and let
the user decide how they want to id a node.
@lijunsong
Copy link
Copy Markdown
Contributor Author

Note: I could clean it up on my end with a squashed commit. But I think you can simply squash it with a click on your end when merge, so I'll let you handle it. Let me know if you need me to clean it.

@mattmassicotte
Copy link
Copy Markdown
Contributor

This is great, thank you!

@mattmassicotte mattmassicotte merged commit e06be7d into tree-sitter:main Jun 5, 2024
jimsynz pushed a commit to jimsynz/outrun that referenced this pull request Oct 13, 2025
… "0.25.0" (#78)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [tree-sitter/swift-tree-sitter](https://github.com/tree-sitter/swift-tree-sitter) | minor | `from: "0.8.0"` -> `from: "0.25.0"` |

---

### Release Notes

<details>
<summary>tree-sitter/swift-tree-sitter (tree-sitter/swift-tree-sitter)</summary>

### [`v0.25.0`](tree-sitter/swift-tree-sitter@0.9.0...0.25.0)

[Compare Source](tree-sitter/swift-tree-sitter@0.9.0...0.25.0)

### [`v0.9.0`](https://github.com/tree-sitter/swift-tree-sitter/releases/tag/0.9.0)

[Compare Source](tree-sitter/swift-tree-sitter@0.8.0...0.9.0)

#### What's Changed

- fix ios cannot load queries issue by [@&#8203;ElvisWong213](https://github.com/ElvisWong213) in [tree-sitter/swift-tree-sitter#22](tree-sitter/swift-tree-sitter#22)
- Replace git submodule with package dependency for tree-sitter integration by [@&#8203;yeatse](https://github.com/yeatse) in [tree-sitter/swift-tree-sitter#23](tree-sitter/swift-tree-sitter#23)
- Hotfix alloc crash, when no read data avail. by [@&#8203;furby-tm](https://github.com/furby-tm) in [tree-sitter/swift-tree-sitter#24](tree-sitter/swift-tree-sitter#24)
- Fix README formatting by [@&#8203;nakajima](https://github.com/nakajima) in [tree-sitter/swift-tree-sitter#27](tree-sitter/swift-tree-sitter#27)
- export tree sitter's id field by [@&#8203;lijunsong](https://github.com/lijunsong) in [tree-sitter/swift-tree-sitter#28](tree-sitter/swift-tree-sitter#28)
- Add `reset` Method On Parser by [@&#8203;thecoolwinter](https://github.com/thecoolwinter) in [tree-sitter/swift-tree-sitter#30](tree-sitter/swift-tree-sitter#30)
- Deprecate `ResolvingQueryCursor. injections()`
- Lots of documentation additions
- `includedRanges` API for both `Tree` and `MutableTree`
- Many bug fixes for `LanguageLayer`
- Sublayer resolution is now opt-in
- Some concurrency-related fixes
- Parser bundle queries are now found on iOS
- Removed the need for escaping closures in parsing functions
- Attempting to use a language layer query that is unsupported now throws
- Use tree-sitter 0.23.0

#### New Contributors

- [@&#8203;ElvisWong213](https://github.com/ElvisWong213) made their first contribution in [tree-sitter/swift-tree-sitter#22](tree-sitter/swift-tree-sitter#22)
- [@&#8203;yeatse](https://github.com/yeatse) made their first contribution in [tree-sitter/swift-tree-sitter#23](tree-sitter/swift-tree-sitter#23)
- [@&#8203;furby-tm](https://github.com/furby-tm) made their first contribution in [tree-sitter/swift-tree-sitter#24](tree-sitter/swift-tree-sitter#24)
- [@&#8203;nakajima](https://github.com/nakajima) made their first contribution in [tree-sitter/swift-tree-sitter#27](tree-sitter/swift-tree-sitter#27)
- [@&#8203;lijunsong](https://github.com/lijunsong) made their first contribution in [tree-sitter/swift-tree-sitter#28](tree-sitter/swift-tree-sitter#28)
- [@&#8203;thecoolwinter](https://github.com/thecoolwinter) made their first contribution in [tree-sitter/swift-tree-sitter#30](tree-sitter/swift-tree-sitter#30)

**Full Changelog**: <tree-sitter/swift-tree-sitter@0.8.0...0.9.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) in timezone Pacific/Auckland, Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) in timezone Pacific/Auckland.

🚦 **Automerge**: Disabled because a matching PR was automerged previously.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNy4wIiwidXBkYXRlZEluVmVyIjoiNDEuODIuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUiXX0=-->

Reviewed-on: https://harton.dev/outrun/outrun/pulls/78
Co-authored-by: Renovate Bot <bot@harton.nz>
Co-committed-by: Renovate Bot <bot@harton.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants