Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree-sitter: Update parent links on reused injection layers #10978

Merged
merged 1 commit into from
Jun 23, 2024

Conversation

the-mikedavis
Copy link
Member

When parsing injections, we skip adding a new layer if there is an existing layer covering the same range. When doing so we did not update the parent layer ID, so some layers could have parent layer IDs that pointed to a layer that no longer existed in the layers HopSlotMap which could cause a panic when using A-o.

To fix this we update the parent pointer for both newly created injection layers and reused ones.

Fixes #10974

When parsing injections, we skip adding a new layer if there is an
existing layer covering the same range. When doing so we did not update
the parent layer ID, so some layers could have `parent` layer IDs that
pointed to a layer that no longer existed in the `layers` HopSlotMap
which could cause a panic when using `A-o`.

To fix this we update the `parent` pointer for both newly created
injection layers and reused ones.
@the-mikedavis the-mikedavis added C-bug Category: This is a bug A-tree-sitter Area: Tree-sitter labels Jun 17, 2024
@archseer archseer merged commit 44e113c into master Jun 23, 2024
6 checks passed
@archseer archseer deleted the tree-sitter-update-injection-parent-links branch June 23, 2024 01:06
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
…itor#10978)

When parsing injections, we skip adding a new layer if there is an
existing layer covering the same range. When doing so we did not update
the parent layer ID, so some layers could have `parent` layer IDs that
pointed to a layer that no longer existed in the `layers` HopSlotMap
which could cause a panic when using `A-o`.

To fix this we update the `parent` pointer for both newly created
injection layers and reused ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tree-sitter Area: Tree-sitter C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helix crashed unexpectedly when trying to <A-o> in Rust
3 participants