-
Notifications
You must be signed in to change notification settings - Fork 13k
Inline childFromLineNumber and childFromCharOffset #17018
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
Conversation
@sheetalkamat PR is ready now. |
src/server/scriptVersionCache.ts
Outdated
zeroBasedColumn: childInfo.relativePosition, | ||
lineText: childInfo.child.text, | ||
}; | ||
Debug.assert(this.children.length !== 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it guaranteed that children
will never be empty when this is called? The previous logic had a specific case to handle that (returning child
as undefined
from childFromCharOffset
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like that is possible for a LineNode to have 0 children if this document is the empty string. Added a test.
Your test is failing. |
Fixed. |
* Inline childFromLineNumber and childFromCharOffset * Handle empty document -- root node with 0 children * Fix test
Should wait on #17017 and be rebased once that's in.
These functions were only used in one place, and the code is simpler if we just directly do the work instead of using two separate functions.