Не подтверждена Коммит 2e66ee07 создал по автору Aaron Munger's avatar Aaron Munger Зафиксировано автором GitHub
Просмотр файлов

listen to other setters for clearing diagnostic (#246791)

listen to other setters
владелец 248716b2
......@@ -15,6 +15,7 @@ import { CodeCellViewModel } from '../../viewModel/codeCellViewModel.js';
import { Event } from '../../../../../../base/common/event.js';
import { IChatAgentService } from '../../../../chat/common/chatAgents.js';
import { ChatAgentLocation } from '../../../../chat/common/constants.js';
import { autorun } from '../../../../../../base/common/observable.js';
export class CellDiagnostics extends Disposable implements INotebookEditorContribution {
......@@ -121,6 +122,11 @@ export class CellDiagnostics extends Disposable implements INotebookEditorContri
disposables.push(toDisposable(() => this.markerService.changeOne(CellDiagnostics.ID, cell.uri, [])));
cell.executionErrorDiagnostic.set(metadata.error, undefined);
disposables.push(toDisposable(() => cell.executionErrorDiagnostic.set(undefined, undefined)));
disposables.push(autorun((r) => {
if (!cell.executionErrorDiagnostic.read(r)) {
this.clear(cellHandle);
}
}));
disposables.push(cell.model.onDidChangeOutputs(() => {
if (cell.model.outputs.length === 0) {
this.clear(cellHandle);
......
......@@ -158,12 +158,12 @@ suite('notebookCellDiagnostics', () => {
testExecutionService.fireExecutionChanged(editor.textModel.uri, cell2.handle);
await new Promise<void>(resolve => Event.once(markerService.onMarkersUpdated)(resolve));
cell.model.internalMetadata.error = undefined;
const clearMarkers = new Promise<void>(resolve => Event.once(markerService.onMarkersUpdated)(resolve));
// on NotebookCellExecution value will make it look like its currently running
testExecutionService.fireExecutionChanged(editor.textModel.uri, cell.handle, {} as INotebookCellExecution);
await new Promise<void>(resolve => Event.once(markerService.onMarkersUpdated)(resolve));
await clearMarkers;
assert.strictEqual(cell?.executionErrorDiagnostic.get(), undefined);
assert.strictEqual(cell2?.executionErrorDiagnostic.get()?.message, 'another bad thing happened', 'cell that was not executed should still have an error');
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать