Change:
Issue Type: <bBug</bSometimes the Markdown preview stops updating when I am typing if the source document is very large. It is not easy to reproduce, but when it happens, it is very annoying. Here is a video clip to describe what happened: ! Notice that at the end, no matter how long I wait, the preview never updates (two s are missing from the preview). It is acceptable if the preview has some delay if the source document is very large, but this seems like some scheduling issue that the final updates from the source document is ignored. The preview should be updated to match the source document if I wait long enough. VS Code version: Code 1.33.1 (, 2019-04-11T08:27:14.102Z) OS version: WindowsNT x64 10.0. <details<summarySystem Info</summary </detailsExtensions disabled <!-- generated by issue reporter --
, Yes this is happening and I think this happens in the case when you change something and then wait for like 2/3 seconds and change something again and similarly repeat it or stop, Just changing once seems to be working but takes some time. , I think the refresh preview calls are getting clogged because of the way the user is updating the markdown document , Can you please confirm any way we can fix this ?
Thanks looking into this. I'm having trouble reproducing this issue but there are two places where I believe that updates to the preview could be getting out of sync: the call to itself: We're currently stabilizing vscode's master branch so I can't check this in but here's a PR that should the problem: the updates to the webview content itself. Here's the code that runs inside the webview that does the update: If you can reproduce this problem, try taking a look the PR and try it out on your local machine to see if it fixes this.
, Not sure exactly how to fix this as the issue is not consistent and when I checked it today, it seems to work ( but surely the preview refresh and sync takes some time, which is considerable for that large file) , So I leave it open for you to take a call on this. I would suggest to check it again and give it some time to update.
Please test this again on the VS Code 1.35 insiders builds that should be coming out at the end of next week
New insiders builds are out. Can you please test this again using them
It seems the problem still exists: ! The last letter is missing from the preview.
I'm closing this given that no one else has reported this issue and no one on the vs code team can reproduce it either Please investigate and submit a fix if you are consistently running into this. I've linked to most of the relevant code locations

Discussion:
}; } <ins> export class PreviewDocumentVersion { public constructor( public readonly resource: vscode.Uri, public readonly version: number, ) { } public equals(other: PreviewDocumentVersion): boolean { return this.resource.fsPath === other.resource.fsPath && this.version === other.version; } } </ins> export class MarkdownPreview extends Disposable { public static viewType = 'markdown.preview';

private throttleTimer: any; private line: number | undefined = undefined; private firstUpdate = true; <del> private currentVersion?: { resource: vscode.Uri, version: number }; </del> <ins> private currentVersion?: PreviewDocumentVersion; </ins> private forceUpdate = false; private isScrolling = false; private _disposed: boolean = false;

return; } <del> if (!this.forceUpdate && this.currentVersion && this.currentVersion.resource.fsPath === resource.fsPath && this.currentVersion.version === document.version) { </del> <ins> const pendingVersion = new PreviewDocumentVersion(resource, document.version); if (!this.forceUpdate && this.currentVersion && this.currentVersion.equals(pendingVersion)) { </ins> if (this.line) { this.updateForView(resource, this.line); }

} this.forceUpdate = false; <del> this.currentVersion = { resource, version: document.version }; </del> <ins> this.currentVersion = pendingVersion; </ins> if (this._resource === resource) { const content = await this._contentProvider.provideTextDocumentContent(document, this._previewConfigurations, this.line, this.state); <del> this.setContent(content); </del> <ins> // Another call to `doUpdate` may have happened. // Make sure we are still updating for the correct document if (this.currentVersion && this.currentVersion.equals(pendingVersion)) { this.setContent(content); } </ins> } }