Skip to content

Commit 5cb98db

Browse files
committed
Disable notebook pause watching
Fix microsoft#127720
1 parent 3d2a28f commit 5cb98db

File tree

1 file changed

+2
-68
lines changed

1 file changed

+2
-68
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/breakpoints/notebookBreakpoints.ts

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
88
import { ResourceMap } from 'vs/base/common/map';
99
import { isEqual } from 'vs/base/common/resources';
10-
import { URI } from 'vs/base/common/uri';
1110
import { Registry } from 'vs/platform/registry/common/platform';
1211
import { Extensions as WorkbenchExtensions, IWorkbenchContribution, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
13-
import { IDebugService, IThread } from 'vs/workbench/contrib/debug/common/debug';
14-
import { Thread } from 'vs/workbench/contrib/debug/common/debugModel';
12+
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug';
1513
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
16-
import { CellEditType, CellUri, NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
14+
import { CellUri, NotebookCellsChangeType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1715
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
1816
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
1917

@@ -99,67 +97,3 @@ class NotebookBreakpoints extends Disposable implements IWorkbenchContribution {
9997
}
10098

10199
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NotebookBreakpoints, LifecyclePhase.Restored);
102-
103-
class NotebookCellPausing extends Disposable implements IWorkbenchContribution {
104-
private readonly _pausedCells = new Set<string>();
105-
106-
constructor(
107-
@IDebugService private readonly _debugService: IDebugService,
108-
@INotebookService private readonly _notebookService: INotebookService
109-
) {
110-
super();
111-
112-
this._register(_debugService.getModel().onDidChangeCallStack(this.onDidChangeCallStack, this));
113-
}
114-
115-
private async onDidChangeCallStack(): Promise<void> {
116-
const newPausedCells = new Set<string>();
117-
118-
const updateForThread = (thread: IThread): void => {
119-
thread.getCallStack().forEach(sf => {
120-
const parsed = CellUri.parse(sf.source.uri);
121-
if (parsed) {
122-
newPausedCells.add(sf.source.uri.toString());
123-
this.editIsPaused(sf.source.uri, true);
124-
}
125-
});
126-
};
127-
128-
const promises: Promise<void>[] = [];
129-
for (const session of this._debugService.getModel().getSessions()) {
130-
for (const thread of session.getAllThreads()) {
131-
const callStack = thread.getCallStack();
132-
if (callStack.length) {
133-
updateForThread(thread);
134-
} else {
135-
promises.push(
136-
(thread as Thread).fetchCallStack().then(() => updateForThread(thread)));
137-
}
138-
}
139-
}
140-
141-
await Promise.all(promises);
142-
for (const uri of this._pausedCells) {
143-
if (!newPausedCells.has(uri)) {
144-
this.editIsPaused(URI.parse(uri), false);
145-
this._pausedCells.delete(uri);
146-
}
147-
}
148-
149-
newPausedCells.forEach(cell => this._pausedCells.add(cell));
150-
}
151-
152-
private editIsPaused(cellUri: URI, isPaused: boolean) {
153-
const parsed = CellUri.parse(cellUri);
154-
if (parsed) {
155-
const notebookModel = this._notebookService.getNotebookTextModel(parsed.notebook);
156-
notebookModel?.applyEdits([{
157-
editType: CellEditType.PartialInternalMetadata,
158-
handle: parsed.handle,
159-
internalMetadata: { isPaused },
160-
}], true, undefined, () => undefined, undefined);
161-
}
162-
}
163-
}
164-
165-
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NotebookCellPausing, LifecyclePhase.Restored);

0 commit comments

Comments
 (0)