Repository navigation
Tag pointers with the tree they were built on - #443
Merged
Merged
Conversation
A JsonPointer is bare tokens, but the AST and the value tree number a list differently past an element in error. Pointers built on the AST have twice been resolved through a value tree; e99887d fixed those sites by convention only. TreePointer<N> carries the walker's node type, so resolving an AST pointer on a value tree is now a compile error. A type parameter rather than two pointer classes lets the one generic navigator tag what it builds and check what it resolves. A pointer written against no tree, such as a $ref fragment, is tagged explicitly where it is resolved. The past-committed-value check and the filled-property filter were safe only because the strict ksonValue is null for a broken document. They now read the AST, so a broken document behaves as a valid one; two completion tests that encoded the old gap now expect this.
dmarcotte
approved these changes
Sep 29, 2026
dmarcotte
left a comment
Contributor
There was a problem hiding this comment.
Thanks @holodorum! Excellent tightening of the code's type requirements here. I've left a few comments which I'd prefer to see address, but I don't think any are blockers, so up to you.
| } | ||
|
|
||
| @Test | ||
| fun testNoValueCompletionsAfterCommittedScalarInBrokenDocument() { |
Contributor
There was a problem hiding this comment.
What does "committed" mean in this context?
Collaborator
Author
There was a problem hiding this comment.
'Committed' in this context means that the value is complete and the caret has moved past it, as opposed to still typing inside it.
Rename buildJsonPointerToPosition to buildTreePointerToPosition: it returns a TreePointer<AstNode> now, so the old name misstated its type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
JsonPointeris bare tokens, but the AST and the value tree number a list differently past an element in error. Pointers built on the AST have twice been resolved through a value tree. A quick fix was introduced in #434, but it would be easy to accidentally re-introduce the bug. This PR fixes it more robustly.TreePointer<N>carries the walker's node type, so resolving an AST pointer on a value tree is now a compile error. A type parameter rather than two pointer classes lets the one generic navigator tag what it builds and check what it resolves. A pointer written against no tree, such as a$reffragment, is tagged explicitly where it is resolved.