Skip to content
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

Update decorators when model contents change #233970

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class NotebookCellDiffDecorator extends DisposableStore {
) {
super();
this.add(this.editor.onDidChangeModel(() => this.update()));
this.add(this.editor.onDidChangeModelContent(() => this.update()));
this.add(this.editor.onDidChangeConfiguration((e) => {
if (e.hasChanged(EditorOption.fontInfo) || e.hasChanged(EditorOption.lineHeight)) {
this.update();
Expand Down Expand Up @@ -105,10 +106,6 @@ export class NotebookCellDiffDecorator extends DisposableStore {
if (this.isDisposed) {
return;
}
if (!this.editor.hasModel()) {
this._clearRendering();
return;
}
if (this.editor.getOption(EditorOption.inDiffEditor)) {
this._clearRendering();
return;
Expand All @@ -119,9 +116,19 @@ export class NotebookCellDiffDecorator extends DisposableStore {
return;
}

const version = model.getVersionId();
const originalModel = this.getOrCreateOriginalModel();
const diff = originalModel ? await this.computeDiff() : undefined;
if (!originalModel) {
this._clearRendering();
return;
}
const version = model.getVersionId();
const diff = await this._editorWorkerService.computeDiff(
originalModel.uri,
model.uri,
{ computeMoves: true, ignoreTrimWhitespace: false, maxComputationTimeMs: Number.MAX_SAFE_INTEGER },
'advanced'
);

if (this.isDisposed) {
return;
}
Expand Down
Loading