Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4997d6

Browse files
committed
Fix compilation
1 parent c63aa94 commit b4997d6

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/client/datascience/interactive-ipynb/nativeEditor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor {
255255
this.synchronizer.notifyUserAction(payload, this);
256256
break;
257257

258-
case InteractiveWindowMessages.ReExecuteCell:
258+
case InteractiveWindowMessages.ReExecuteCells:
259259
this.executedEvent.fire(this);
260260
break;
261261

src/client/datascience/interactive-ipynb/nativeEditorOldWebView.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
} from '../types';
5151
import { NativeEditor } from './nativeEditor';
5252
import { NativeEditorStorage } from './nativeEditorStorage';
53+
import { NativeEditorSynchronizer } from './nativeEditorSynchronizer';
5354

5455
enum AskForSaveResult {
5556
Yes,
@@ -85,6 +86,7 @@ export class NativeEditorOldWebView extends NativeEditor {
8586
@inject(ICommandManager) commandManager: ICommandManager,
8687
@inject(INotebookExporter) jupyterExporter: INotebookExporter,
8788
@inject(IWorkspaceService) workspaceService: IWorkspaceService,
89+
@inject(NativeEditorSynchronizer) synchronizer: NativeEditorSynchronizer,
8890
@inject(INotebookEditorProvider) editorProvider: INotebookEditorProvider,
8991
@inject(IDataViewerProvider) dataExplorerProvider: IDataViewerProvider,
9092
@inject(IJupyterVariables) jupyterVariables: IJupyterVariables,
@@ -114,6 +116,7 @@ export class NativeEditorOldWebView extends NativeEditor {
114116
commandManager,
115117
jupyterExporter,
116118
workspaceService,
119+
synchronizer,
117120
editorProvider,
118121
dataExplorerProvider,
119122
jupyterVariables,
@@ -127,6 +130,7 @@ export class NativeEditorOldWebView extends NativeEditor {
127130
switcher
128131
);
129132
asyncRegistry.push(this);
133+
synchronizer.disable();
130134
}
131135
public async load(model: INotebookModel, webViewPanel: WebviewPanel): Promise<void> {
132136
await super.load(model, webViewPanel);
@@ -263,7 +267,7 @@ export class NativeEditorOldWebView extends NativeEditor {
263267

264268
const defaultUri =
265269
Array.isArray(this.workspaceService.workspaceFolders) &&
266-
this.workspaceService.workspaceFolders.length > 0
270+
this.workspaceService.workspaceFolders.length > 0
267271
? this.workspaceService.workspaceFolders[0].uri
268272
: undefined;
269273
fileToSaveTo = await this.applicationShell.showSaveDialog({

src/client/datascience/interactive-ipynb/nativeEditorSynchronizer.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ import { INotebookEditor } from '../types';
1111

1212
// tslint:disable: no-any
1313

14-
type UserActionNotificationCallback = <M extends IInteractiveWindowMapping, T extends keyof M>(type: T, payload?: M[T]) => void;
14+
type UserActionNotificationCallback = <M extends IInteractiveWindowMapping, T extends keyof M>(
15+
type: T,
16+
payload?: M[T]
17+
) => void;
1518

1619
@injectable()
1720
export class NativeEditorSynchronizer {
1821
private registeredNotebooks = new Map<INotebookEditor, UserActionNotificationCallback>();
19-
constructor(@inject(IFileSystem) private readonly fs: IFileSystem) {}
22+
private enabled = false;
23+
constructor(@inject(IFileSystem) private readonly fs: IFileSystem) { }
2024
public notifyUserAction(message: SyncPayload, editor: INotebookEditor) {
25+
if (!this.enabled) {
26+
return;
27+
}
2128
this.registeredNotebooks.forEach((cb, item) => {
2229
if (item !== editor && this.fs.arePathsSame(item.file.fsPath, editor.file.fsPath)) {
2330
cb(InteractiveWindowMessages.Sync, message as any);
@@ -27,4 +34,8 @@ export class NativeEditorSynchronizer {
2734
public subscribeToUserActions(editor: INotebookEditor, cb: UserActionNotificationCallback) {
2835
this.registeredNotebooks.set(editor, cb);
2936
}
37+
public disable() {
38+
this.enabled = false;
39+
this.registeredNotebooks.clear();
40+
}
3041
}

0 commit comments

Comments
 (0)