提交 d202b5fa 编写于 作者: M Matt Bierner

Fix md preview settings not getitng applies until reopen

Fixes #44577
上级 3afd4c84
...@@ -288,6 +288,7 @@ class MarkdownPreview { ...@@ -288,6 +288,7 @@ class MarkdownPreview {
private readonly disposables: vscode.Disposable[] = []; private readonly disposables: vscode.Disposable[] = [];
private firstUpdate = true; private firstUpdate = true;
private currentVersion?: { resource: vscode.Uri, version: number }; private currentVersion?: { resource: vscode.Uri, version: number };
private _forceUpdate: boolean = false;
constructor( constructor(
private _resource: vscode.Uri, private _resource: vscode.Uri,
...@@ -371,6 +372,7 @@ class MarkdownPreview { ...@@ -371,6 +372,7 @@ class MarkdownPreview {
} }
public refresh() { public refresh() {
this._forceUpdate = true;
this.update(this._resource); this.update(this._resource);
} }
...@@ -440,12 +442,13 @@ class MarkdownPreview { ...@@ -440,12 +442,13 @@ class MarkdownPreview {
this.throttleTimer = undefined; this.throttleTimer = undefined;
const document = await vscode.workspace.openTextDocument(resource); const document = await vscode.workspace.openTextDocument(resource);
if (this.currentVersion && this.currentVersion.resource.fsPath === resource.fsPath && this.currentVersion.version === document.version) { if (!this._forceUpdate && this.currentVersion && this.currentVersion.resource.fsPath === resource.fsPath && this.currentVersion.version === document.version) {
if (this.initialLine) { if (this.initialLine) {
this.updateForView(resource, this.initialLine); this.updateForView(resource, this.initialLine);
} }
return; return;
} }
this._forceUpdate = false;
this.currentVersion = { resource, version: document.version }; this.currentVersion = { resource, version: document.version };
this.contentProvider.provideTextDocumentContent(document, this.previewConfigurations, this.initialLine) this.contentProvider.provideTextDocumentContent(document, this.previewConfigurations, this.initialLine)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册