-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Add event for when tree tokens change #228593
Conversation
@@ -102,7 +105,13 @@ export class TextModelTreeSitter extends Disposable { | |||
} | |||
|
|||
private async _onDidChangeContent(treeSitterTree: TreeSitterParseResult, changes: IModelContentChange[]) { | |||
return treeSitterTree.onDidChangeContent(this.model, changes); | |||
const oldTree = treeSitterTree.tree?.copy(); | |||
await treeSitterTree.onDidChangeContent(this.model, changes); |
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.
Not sure if that is a problem here, but subsequent onDidChangeContent event calls can make multiple promises to get stuck here.
Then line 110 might cause a race condition, depending on which promise resolves first.
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.
The actual changes done in onDidChangecontent
are queued, so don't think we need to worry about the order in which they are resolved: they will always be sequential.
However, we could end up with this._onDidChangeParseResult
firing with the same range multiple times.
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.
Attempted to address in #228986.
Part of #210475