Skip to content

Commit 9ea4237

Browse files
committed
Get everything building again
1 parent 00e4803 commit 9ea4237

File tree

8 files changed

+30
-13
lines changed

8 files changed

+30
-13
lines changed

src/client/datascience/interactive-common/synchronization.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const messageWithMessageTypes: MessageMapping<IInteractiveWindowMapping> & Messa
6767
[CommonActionType.LINK_CLICK]: MessageType.userAction,
6868
[CommonActionType.MOVE_CELL_DOWN]: MessageType.syncAcrossSameNotebooks | MessageType.syncWithLiveShare,
6969
[CommonActionType.MOVE_CELL_UP]: MessageType.syncAcrossSameNotebooks | MessageType.syncWithLiveShare,
70+
[CommonActionType.OPEN_SETTINGS]: MessageType.userAction,
7071
[CommonActionType.RESTART_KERNEL]: MessageType.userAction,
7172
[CommonActionType.SAVE]: MessageType.userAction,
7273
[CommonActionType.SCROLL]: MessageType.syncWithLiveShare,
@@ -83,6 +84,7 @@ const messageWithMessageTypes: MessageMapping<IInteractiveWindowMapping> & Messa
8384
[CommonActionType.UNMOUNT]: MessageType.userAction,
8485
[CommonActionType.PostOutgoingMessage]: MessageType.userAction,
8586
[CommonActionType.REFRESH_VARIABLES]: MessageType.userAction,
87+
[CommonActionType.FOCUS_INPUT]: MessageType.userAction,
8688

8789
// Types from InteractiveWindowMessages
8890
[InteractiveWindowMessages.Activate]: MessageType.userAction,
@@ -125,13 +127,14 @@ const messageWithMessageTypes: MessageMapping<IInteractiveWindowMapping> & Messa
125127
[InteractiveWindowMessages.NotebookRunAllCells]: MessageType.userAction,
126128
[InteractiveWindowMessages.NotebookRunSelectedCell]: MessageType.userAction,
127129
[InteractiveWindowMessages.OpenLink]: MessageType.userAction,
130+
[InteractiveWindowMessages.OpenSettings]: MessageType.userAction,
128131
[InteractiveWindowMessages.ProvideCompletionItemsRequest]: MessageType.userAction,
129132
[InteractiveWindowMessages.ProvideCompletionItemsResponse]: MessageType.userAction,
130133
[InteractiveWindowMessages.ProvideHoverRequest]: MessageType.userAction,
131134
[InteractiveWindowMessages.ProvideHoverResponse]: MessageType.userAction,
132135
[InteractiveWindowMessages.ProvideSignatureHelpRequest]: MessageType.userAction,
133136
[InteractiveWindowMessages.ProvideSignatureHelpResponse]: MessageType.userAction,
134-
[InteractiveWindowMessages.ReExecuteCell]: MessageType.userAction,
137+
[InteractiveWindowMessages.ReExecuteCells]: MessageType.userAction,
135138
[InteractiveWindowMessages.Redo]: MessageType.userAction,
136139
[InteractiveWindowMessages.RemoteAddCode]: MessageType.userAction,
137140
[InteractiveWindowMessages.ReceivedUpdateModel]: MessageType.userAction,

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ import {
8484
WebViewViewChangeEventArgs
8585
} from '../types';
8686

87-
// tslint:disable-next-line: no-require-imports
8887
import { nbformat } from '@jupyterlab/coreutils';
88+
// tslint:disable-next-line: no-require-imports
8989
import cloneDeep = require('lodash/cloneDeep');
9090

9191
const nativeEditorDir = path.join(EXTENSION_ROOT_DIR, 'out', 'datascience-ui', 'notebook');
@@ -105,7 +105,6 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor {
105105
private loadedAllCells: boolean = false;
106106
private _model: INotebookModel | undefined;
107107
private executeCancelTokens = new Set<CancellationTokenSource>();
108-
private _disposed = false;
109108

110109
constructor(
111110
@multiInject(IInteractiveWindowListener) listeners: IInteractiveWindowListener[],
@@ -191,7 +190,6 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor {
191190
}
192191

193192
public dispose(): Promise<void> {
194-
this._disposed = true;
195193
super.dispose();
196194
return this.close();
197195
}

src/datascience-ui/history-react/redux/actions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
ICodeCreatedAction,
1717
IEditCellAction,
1818
ILinkClickAction,
19+
IOpenSettingsAction,
1920
IScrollAction,
2021
IShowDataViewerAction
2122
} from '../../interactive-common/redux/reducers/types';
@@ -36,6 +37,7 @@ function createIncomingAction(type: CommonActionType | InteractiveWindowMessages
3637

3738
// See https://react-redux.js.org/using-react-redux/connect-mapdispatch#defining-mapdispatchtoprops-as-an-object
3839
export const actionCreators = {
40+
focusInput: (): CommonAction => createIncomingAction(CommonActionType.FOCUS_INPUT),
3941
restartKernel: (): CommonAction => createIncomingAction(CommonActionType.RESTART_KERNEL),
4042
interruptKernel: (): CommonAction => createIncomingAction(CommonActionType.INTERRUPT_KERNEL),
4143
deleteAllCells: (): CommonAction => createIncomingAction(InteractiveWindowMessages.DeleteAllCells),
@@ -84,6 +86,8 @@ export const actionCreators = {
8486
editorUnmounted: (): CommonAction => createIncomingAction(CommonActionType.UNMOUNT),
8587
selectKernel: (): CommonAction => createIncomingAction(InteractiveWindowMessages.SelectKernel),
8688
selectServer: (): CommonAction => createIncomingAction(CommonActionType.SELECT_SERVER),
89+
openSettings: (setting?: string): CommonAction<IOpenSettingsAction> =>
90+
createIncomingActionWithPayload(CommonActionType.OPEN_SETTINGS, { setting }),
8791
getVariableData: (
8892
newExecutionCount: number,
8993
startIndex: number = 0,

src/datascience-ui/interactive-common/redux/reducers/commonEffects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { IGetMonacoThemeResponse } from '../../../../client/datascience/monacoMe
88
import { IMainState } from '../../../interactive-common/mainState';
99
import { Helpers } from '../../../interactive-common/redux/reducers/helpers';
1010
import { storeLocStrings } from '../../../react-common/locReactSide';
11-
import { CommonActionType, CommonReducerArg } from './types';
11+
import { postActionToExtension } from '../helpers';
12+
import { CommonActionType, CommonReducerArg, IOpenSettingsAction } from './types';
1213

1314
export namespace CommonEffects {
1415
export function notebookDirty(arg: CommonReducerArg): IMainState {
@@ -123,9 +124,8 @@ export namespace CommonEffects {
123124
};
124125
}
125126

126-
export function openSettings(arg: CommonReducerArg): IMainState {
127-
arg.queueAction(createPostableAction(InteractiveWindowMessages.OpenSettings));
128-
127+
export function openSettings(arg: CommonReducerArg<CommonActionType, IOpenSettingsAction>): IMainState {
128+
postActionToExtension(arg, InteractiveWindowMessages.OpenSettings, arg.payload.data.setting);
129129
return arg.prevState;
130130
}
131131
}

src/datascience-ui/interactive-common/redux/reducers/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export enum CommonActionType {
5959
LINK_CLICK = 'action.link_click',
6060
MOVE_CELL_DOWN = 'action.move_cell_down',
6161
MOVE_CELL_UP = 'action.move_cell_up',
62+
OPEN_SETTINGS = 'action.open_settings',
6263
PostOutgoingMessage = 'action.postOutgoingMessage',
6364
REFRESH_VARIABLES = 'action.refresh_variables',
6465
RESTART_KERNEL = 'action.restart_kernel_action',
@@ -126,6 +127,8 @@ export type CommonActionTypeMapping = {
126127
[CommonActionType.TOGGLE_VARIABLE_EXPLORER]: never | undefined;
127128
[CommonActionType.PostOutgoingMessage]: never | undefined;
128129
[CommonActionType.REFRESH_VARIABLES]: never | undefined;
130+
[CommonActionType.OPEN_SETTINGS]: IOpenSettingsAction;
131+
[CommonActionType.FOCUS_INPUT]: never | undefined;
129132
};
130133

131134
export interface IShowDataViewerAction extends IShowDataViewer {}
@@ -198,4 +201,8 @@ export interface IChangeCellTypeAction {
198201
cellId: string;
199202
currentCode: string;
200203
}
204+
205+
export interface IOpenSettingsAction {
206+
setting: string | undefined;
207+
}
201208
export type CommonAction<T = never | undefined> = ActionWithPayload<T, CommonActionType | InteractiveWindowMessages>;

src/datascience-ui/native-editor/redux/actions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
ICodeCreatedAction,
2020
IEditCellAction,
2121
ILinkClickAction,
22+
IOpenSettingsAction,
2223
ISendCommandAction,
2324
IShowDataViewerAction
2425
} from '../../interactive-common/redux/reducers/types';
@@ -115,6 +116,8 @@ export const actionCreators = {
115116
editorUnmounted: (): CommonAction => createIncomingAction(CommonActionType.UNMOUNT),
116117
selectKernel: (): CommonAction => createIncomingAction(InteractiveWindowMessages.SelectKernel),
117118
selectServer: (): CommonAction => createIncomingAction(CommonActionType.SELECT_SERVER),
119+
openSettings: (setting?: string): CommonAction<IOpenSettingsAction> =>
120+
createIncomingActionWithPayload(CommonActionType.OPEN_SETTINGS, { setting }),
118121
getVariableData: (
119122
newExecutionCount: number,
120123
startIndex: number = 0,

src/test/datascience/interactive-ipynb/nativeEditorProvider.unit.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ suite('Data Science - Native Editor Provider', () => {
3737
svcContainer = mock(ServiceContainer);
3838
configService = mock(ConfigurationService);
3939
workspace = mock(WorkspaceService);
40+
storage = typemoq.Mock.ofType<INotebookStorage & INotebookModel>();
4041
customEditorService = typemoq.Mock.ofType<ICustomEditorService>();
4142
panel = typemoq.Mock.ofType<WebviewPanel>();
4243
panel.setup(e => (e as any).then).returns(() => undefined);
@@ -45,8 +46,6 @@ suite('Data Science - Native Editor Provider', () => {
4546
function createNotebookProvider() {
4647
editor = typemoq.Mock.ofType<INotebookEditor>();
4748
when(configService.getSettings(anything())).thenReturn({ datascience: { useNotebookEditor: true } } as any);
48-
when(docManager.onDidChangeActiveTextEditor).thenReturn(changeActiveTextEditorEventEmitter.event);
49-
when(docManager.visibleTextEditors).thenReturn([]);
5049
editor.setup(e => e.closed).returns(() => new EventEmitter<INotebookEditor>().event);
5150
editor.setup(e => e.executed).returns(() => new EventEmitter<INotebookEditor>().event);
5251
editor.setup(e => (e as any).then).returns(() => undefined);

src/test/datascience/nativeEditor.functional.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33
'use strict';
44
import { nbformat } from '@jupyterlab/coreutils';
5-
import { assert, use } from 'chai';
5+
import { assert, expect, use } from 'chai';
66
import * as chaiAsPromised from 'chai-as-promised';
77
import * as dedent from 'dedent';
88
import { ReactWrapper } from 'enzyme';
@@ -29,6 +29,7 @@ import {
2929
} from '../../client/datascience/types';
3030
import { PythonInterpreter } from '../../client/interpreter/contracts';
3131
import { Editor } from '../../datascience-ui/interactive-common/editor';
32+
import { ExecutionCount } from '../../datascience-ui/interactive-common/executionCount';
3233
import { CommonActionType } from '../../datascience-ui/interactive-common/redux/reducers/types';
3334
import { NativeCell } from '../../datascience-ui/native-editor/nativeCell';
3435
import { NativeEditor } from '../../datascience-ui/native-editor/nativeEditor';
@@ -71,7 +72,6 @@ import {
7172
waitForMessage,
7273
waitForMessageResponse
7374
} from './testHelpers';
74-
import { ExecutionCount } from '../../datascience-ui/interactive-common/executionCount';
7575

7676
use(chaiAsPromised);
7777

@@ -540,7 +540,9 @@ df.head()`;
540540
numberOfTimes: 3
541541
});
542542
runAllButton = findButton(newWrapper!, NativeEditor, 0);
543-
renderAll = waitForMessage(ioc, InteractiveWindowMessages.ExecutionRendered, { numberOfTimes: 3 });
543+
threeCellsUpdated = waitForMessage(ioc, InteractiveWindowMessages.ExecutionRendered, {
544+
numberOfTimes: 3
545+
});
544546
await waitForMessageResponse(ioc, () => runAllButton!.simulate('click'));
545547
await threeCellsUpdated;
546548
verifyHtmlOnCell(newWrapper!, 'NativeCell', `1`, 0);
@@ -1681,6 +1683,7 @@ df.head()`;
16811683
numberOfTimes: 3
16821684
});
16831685
await waitForMessageResponse(ioc, () => runAllButton!.simulate('click'));
1686+
await threeCellsUpdated;
16841687

16851688
const saveButton = findButton(wrapper, NativeEditor, 8);
16861689
let saved = waitForMessage(ioc, InteractiveWindowMessages.NotebookClean);

0 commit comments

Comments
 (0)