Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
"--extensionDevelopmentPath=${workspaceFolder}",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored running tests against insiders.

"--enable-proposed-api",
"ms-python.python"
],
"stopOnEntry": false,
"smartStep": true,
Expand Down
5 changes: 4 additions & 1 deletion src/client/common/insidersBuild/insidersExtensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ export class InsidersExtensionService implements IExtensionSingleActivationServi
* @returns `true` if install channel is handled in these miscellaneous cases, `false` if install channel needs further handling
*/
public async handleEdgeCases(installChannel: ExtensionChannels, isDefault: boolean): Promise<boolean> {
if (await this.promptToInstallInsidersIfApplicable(isDefault)) {
// When running UI Tests we might want to disable these prompts.
if (process.env.UITEST_DISABLE_INSIDERS) {
return true;
} else if (await this.promptToInstallInsidersIfApplicable(isDefault)) {
return true;
} else if (await this.setInsidersChannelToOffIfApplicable(installChannel)) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/datascience-ui/native-editor/nativeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export class NativeCell extends React.Component<INativeCellProps> {
break;
case 'z':
case 'Z':
if (!this.isFocused() && !UseCustomEditor) {
if (!this.isFocused() && !UseCustomEditor.enabled) {
if (e.shiftKey && !e.ctrlKey && !e.altKey) {
e.stopPropagation();
this.props.redo();
Expand Down Expand Up @@ -637,7 +637,7 @@ export class NativeCell extends React.Component<INativeCellProps> {
keyDown={this.keyDownInput}
showLineNumbers={this.props.cellVM.showLineNumbers}
font={this.props.font}
disableUndoStack={UseCustomEditor}
disableUndoStack={UseCustomEditor.enabled}
codeVersion={this.props.cellVM.codeVersion ? this.props.cellVM.codeVersion : 1}
focusPending={this.props.focusPending}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/datascience-ui/native-editor/nativeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ${buildSettingsCss(this.props.settings)}`}</style>
}
case 'z':
case 'Z':
if (!getSelectedAndFocusedInfo(this.props).focusedCellId && !UseCustomEditor) {
if (!getSelectedAndFocusedInfo(this.props).focusedCellId && !UseCustomEditor.enabled) {
if (event.shiftKey && !event.ctrlKey && !event.altKey) {
event.stopPropagation();
this.props.redo();
Expand Down
2 changes: 1 addition & 1 deletion src/datascience-ui/react-common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export function getOSType() {
}
}

export const UseCustomEditor = true;
export const UseCustomEditor = { enabled: true };
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we're supporting both custom and old editors. We need tests for both.
This object allows us to toggle from tests.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to support both? Once this ships we're not using the old way anymore.

Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ suite('Insiders Extension Service - Activation', () => {
let handleEdgeCases: sinon.SinonStub<any>;
let insidersInstaller: IExtensionBuildInstaller;
let insidersExtensionService: InsidersExtensionService;
let envUITEST_DISABLE_INSIDERSExists = false;
setup(() => {
envUITEST_DISABLE_INSIDERSExists = process.env.UITEST_DISABLE_INSIDERS !== undefined;
delete process.env.UITEST_DISABLE_INSIDERS;
extensionChannelService = mock(ExtensionChannelService);
insidersInstaller = mock(InsidersBuildInstaller);
appEnvironment = mock(ApplicationEnvironment);
Expand All @@ -119,6 +122,9 @@ suite('Insiders Extension Service - Activation', () => {
});

teardown(() => {
if (envUITEST_DISABLE_INSIDERSExists) {
process.env.UITEST_DISABLE_INSIDERS = '1';
}
sinon.restore();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { expect } from 'chai';
import { anything, instance, mock, when } from 'ts-mockito';
import * as typemoq from 'typemoq';
import { EventEmitter, Uri, WebviewPanel } from 'vscode';
import { ICustomEditorService, IWorkspaceService } from '../../../client/common/application/types';
import { CustomDocument, ICustomEditorService, IWorkspaceService } from '../../../client/common/application/types';
import { WorkspaceService } from '../../../client/common/application/workspace';
import { AsyncDisposableRegistry } from '../../../client/common/asyncDisposableRegistry';
import { ConfigurationService } from '../../../client/common/configuration/service';
Expand Down Expand Up @@ -65,10 +65,13 @@ suite('Data Science - Native Editor Provider', () => {
.returns((_a1, _a2, _a3) => {
return { dispose: noop };
});

customEditorService
.setup(c => c.openEditor(typemoq.It.isAny()))
.returns(async f => {
return registeredProvider.resolveCustomEditor(f, panel.object);
const doc = typemoq.Mock.ofType<CustomDocument>();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was broken

doc.setup(d => d.uri).returns(() => f);
return registeredProvider.resolveCustomEditor(doc.object, panel.object);
});

editor
Expand Down
3 changes: 3 additions & 0 deletions src/test/datascience/nativeEditor.functional.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { ExecutionCount } from '../../datascience-ui/interactive-common/executio
import { CommonActionType } from '../../datascience-ui/interactive-common/redux/reducers/types';
import { NativeCell } from '../../datascience-ui/native-editor/nativeCell';
import { NativeEditor } from '../../datascience-ui/native-editor/nativeEditor';
import { UseCustomEditor } from '../../datascience-ui/react-common/constants';
import { IKeyboardEvent } from '../../datascience-ui/react-common/event';
import { ImageButton } from '../../datascience-ui/react-common/imageButton';
import { IMonacoEditorState, MonacoEditor } from '../../datascience-ui/react-common/monacoEditor';
Expand Down Expand Up @@ -127,6 +128,7 @@ suite('DataScience Native Editor', () => {
};

setup(async () => {
UseCustomEditor.enabled = useCustomEditorApi;
ioc = new DataScienceIocContainer();
ioc.registerDataScienceTypes(useCustomEditorApi);

Expand Down Expand Up @@ -899,6 +901,7 @@ df.head()`;
cleanupCallback: Function;
};
function initIoc() {
UseCustomEditor.enabled = useCustomEditorApi;
ioc = new DataScienceIocContainer();
ioc.registerDataScienceTypes(useCustomEditorApi);
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/debuggerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function start() {
extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: 'insiders'
version: 'insiders',
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }
}).catch(ex => {
console.error('End Debugger tests (with errors)', ex);
process.exit(1);
Expand Down
5 changes: 3 additions & 2 deletions src/test/multiRootTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ function start() {
runTests({
extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: 'stable'
launchArgs: [workspacePath, '--enable-proposed-api', 'ms-python.python'],
version: 'insiders',
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }
}).catch(ex => {
console.error('End Multiroot tests (with errors)', ex);
process.exit(1);
Expand Down
5 changes: 3 additions & 2 deletions src/test/standardTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ function start() {
runTests({
extensionDevelopmentPath: extensionDevelopmentPath,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: 'stable'
launchArgs: [workspacePath, '--enable-proposed-api', 'ms-python.python'],
version: 'insiders',
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' }
}).catch(ex => {
console.error('End Standard tests (with errors)', ex);
process.exit(1);
Expand Down