Открыть боковую панель
code
vscode
Коммиты
2e66ee07
Не подтверждена
Коммит
2e66ee07
создал
Апр 17, 2025
по автору
Aaron Munger
Зафиксировано автором
GitHub
Апр 17, 2025
Просмотр файлов
listen to other setters for clearing diagnostic (#246791)
listen to other setters
владелец
248716b2
Изменения
2
Скрыть пробелы
Построчно
Рядом
src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.ts
Просмотр файла @
2e66ee07
...
...
@@ -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
);
...
...
src/vs/workbench/contrib/notebook/test/browser/contrib/notebookCellDiagnostics.test.ts
Просмотр файла @
2e66ee07
...
...
@@ -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.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать