Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f7ad067
Davidkutu/ds interactive window focus fix (#9895)
Feb 4, 2020
15d40c4
Fix variables on mac and linux (#9897) (#9903)
rchiodo Feb 4, 2020
20e5ee2
Fix focusing of cells when navigating cells using up/down arrow (#988…
DonJayamanne Feb 5, 2020
d2b3f15
Disable webHostNotebook experiment and fix name of exp (#9894) (#9907)
DonJayamanne Feb 5, 2020
9f5ac3f
Davidkutu/ds scrapbook render fix (#9912)
Feb 5, 2020
8d7636e
Disable the terminal activation experiment (#9937)
DonJayamanne Feb 6, 2020
8805276
Notebook should use kernel from metadata (#9936)
DonJayamanne Feb 6, 2020
d022524
Port server cache fix to release (#9932)
IanMatthewHuff Feb 6, 2020
ed09569
Port variable restart fix (#9938)
rchiodo Feb 6, 2020
415cab4
Do not override kernels info in other notebooks (#9958)
DonJayamanne Feb 6, 2020
abb5d14
Disables the use of a terminal to activate an environment (#9967)
DonJayamanne Feb 7, 2020
3976296
Port server name fix to release (#9970)
IanMatthewHuff Feb 7, 2020
4946e5c
When starting Jupyter activate conda env (#9972)
DonJayamanne Feb 7, 2020
3be03b0
Porting K8 fix to release (#9987)
IanMatthewHuff Feb 7, 2020
36fee5c
Update version and changelog date for release (#10022)
karthiknadig Feb 10, 2020
7a26421
Ignore FS errors from stat() in some cases. (#10032)
Feb 10, 2020
f2d788c
Update chang log (#10041)
karthiknadig Feb 11, 2020
ffbe5e1
Install jupyter instead of installing kernel spec (#10080) (#10083)
DonJayamanne Feb 12, 2020
c8895be
Fix for zh-tw loading issue. (#10085) (#10089)
karthiknadig Feb 12, 2020
5066319
Update version and changelog for point release. (#10091)
karthiknadig Feb 12, 2020
dcc695c
Port fixes for second point release. (#10146)
rchiodo Feb 18, 2020
933101a
Cherry pick more fixes for feb point2 (#10183)
DonJayamanne Feb 18, 2020
ea89876
fix SVG mimetype name (#10181) (#10185)
IanMatthewHuff Feb 18, 2020
7a01a9a
Update change log
DonJayamanne Feb 19, 2020
71642d3
Some more ds telemetry (#10218)
DonJayamanne Feb 19, 2020
a3f0932
Update date in change log
DonJayamanne Feb 19, 2020
4dc2d43
Merge branch 'release-2020.02' of github.com:microsoft/vscode-python …
DonJayamanne Feb 19, 2020
9bcce5e
Point release with fix for Issue 10250 (#10254)
DonJayamanne Feb 21, 2020
a90813a
merging into master
karthiknadig Feb 21, 2020
3059c18
Clean up
karthiknadig Feb 21, 2020
78ead84
More clean up
karthiknadig Feb 21, 2020
1b50305
Some more text fixes
karthiknadig Feb 21, 2020
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
Next Next commit
Davidkutu/ds interactive window focus fix (#9895)
* Fixed the focus on the interactive window
when pressing ctrl +2

* the new prop 'focusPending' needs to change in
order to give focus

* added functional test

* In test: force focus to buttons to take it away from

* finished the functional test

* updated changelog

* deleted bug#.md
  • Loading branch information
David Kutugata
David Kutugata authored Feb 4, 2020
commit f7ad067f28b3eadb880bd48d3047963439edde5f
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

### Fixes

1. Fixed the focus on the interactive window when pressing ctrl + 1/ ctrl + 2
([#9693](https://github.com/microsoft/vscode-python/issues/9693))
1. Fix variable explorer in Interactive and Notebook editors from interfering with execution.
([#5980](https://github.com/Microsoft/vscode-python/issues/5980))
1. Fix a crash when using pytest to discover doctests with unknown line number.
Expand Down
2 changes: 2 additions & 0 deletions src/datascience-ui/history-react/interactiveCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface IInteractiveCellBaseProps {
editorMeasureClassName?: string;
font: IFont;
settings: IDataScienceExtraSettings;
focusPending: number;
}

type IInteractiveCellProps = IInteractiveCellBaseProps & typeof actionCreators;
Expand Down Expand Up @@ -266,6 +267,7 @@ export class InteractiveCell extends React.Component<IInteractiveCellProps> {
keyDown={this.isEditCell() ? this.onEditCellKeyDown : undefined}
showLineNumbers={this.props.cellVM.showLineNumbers}
font={this.props.font}
focusPending={this.props.focusPending}
/>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/datascience-ui/history-react/interactivePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class InteractivePanel extends React.Component<IInteractivePanelProps> {
monacoTheme={this.props.monacoTheme}
font={this.props.font}
settings={this.props.settings}
focusPending={this.props.activateCount}
/>
</ErrorBoundary>
</div>
Expand Down Expand Up @@ -279,6 +280,7 @@ export class InteractivePanel extends React.Component<IInteractivePanelProps> {
monacoTheme={this.props.monacoTheme}
font={this.props.font}
settings={this.props.settings}
focusPending={this.props.activateCount}
/>
</ErrorBoundary>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/datascience-ui/interactive-common/cellInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface ICellInputProps {
editorMeasureClassName?: string;
showLineNumbers?: boolean;
font: IFont;
focusPending: number;
onCodeChange(changes: monacoEditor.editor.IModelContentChange[], cellId: string, modelId: string): void;
onCodeCreated(code: string, file: string, cellId: string, modelId: string): void;
openLink(uri: monacoEditor.Uri): void;
Expand Down Expand Up @@ -110,6 +111,7 @@ export class CellInput extends React.Component<ICellInputProps> {
showLineNumbers={this.props.showLineNumbers}
useQuickEdit={this.props.cellVM.useQuickEdit}
font={this.props.font}
focusPending={this.props.focusPending}
/>
</div>
);
Expand Down
7 changes: 7 additions & 0 deletions src/datascience-ui/interactive-common/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface ICodeProps {
font: IFont;
hasFocus: boolean;
cursorPos: CursorPos;
focusPending: number;
onCreated(code: string, modelId: string): void;
onChange(changes: monacoEditor.editor.IModelContentChange[], modelId: string): void;
openLink(uri: monacoEditor.Uri): void;
Expand All @@ -46,6 +47,12 @@ export class Code extends React.Component<ICodeProps, ICodeState> {
this.state = { allowWatermark: true };
}

public componentDidUpdate(prevProps: ICodeProps) {
if (prevProps.focusPending !== this.props.focusPending) {
this.giveFocus(CursorPos.Current);
}
}

public render() {
const readOnly = this.props.readOnly;
const waterMarkClass = this.props.showWatermark && this.state.allowWatermark && !readOnly ? 'code-watermark' : 'hide';
Expand Down
2 changes: 2 additions & 0 deletions src/datascience-ui/native-editor/nativeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface INativeCellBaseProps {
enableGather: boolean | undefined;
editorOptions: monacoEditor.editor.IEditorOptions;
themeMatplotlibPlots: boolean | undefined;
focusPending: number;
}

type INativeCellProps = INativeCellBaseProps & typeof actionCreators;
Expand Down Expand Up @@ -597,6 +598,7 @@ export class NativeCell extends React.Component<INativeCellProps> {
keyDown={this.keyDownInput}
showLineNumbers={this.props.cellVM.showLineNumbers}
font={this.props.font}
focusPending={this.props.focusPending}
/>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/datascience-ui/native-editor/nativeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ export class NativeEditor extends React.Component<INativeEditorProps> {
editorOptions={this.props.editorOptions}
enableGather={this.props.settings.enableGather}
themeMatplotlibPlots={this.props.settings.themeMatplotlibPlots}
focusPending={this.props.activateCount}
/>
</ErrorBoundary>
{lastLine}
Expand Down
22 changes: 11 additions & 11 deletions src/test/datascience/dataScienceIocContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,17 +898,7 @@ export class DataScienceIocContainer extends UnitTestIocContainer {
}
}

private findPythonPath(): string {
try {
// Give preference to the CI test python (could also be set in launch.json for debugging).
const output = child_process.execFileSync(process.env.CI_PYTHON_PATH || 'python', ['-c', 'import sys;print(sys.executable)'], { encoding: 'utf8' });
return output.replace(/\r?\n/g, '');
} catch (ex) {
return 'python';
}
}

private postMessageToWebPanel(msg: any) {
public postMessageToWebPanel(msg: any) {
if (this.webPanelListener) {
this.webPanelListener.onMessage(msg.type, msg.payload);
} else {
Expand All @@ -923,6 +913,16 @@ export class DataScienceIocContainer extends UnitTestIocContainer {
}
}

private findPythonPath(): string {
try {
// Give preference to the CI test python (could also be set in launch.json for debugging).
const output = child_process.execFileSync(process.env.CI_PYTHON_PATH || 'python', ['-c', 'import sys;print(sys.executable)'], { encoding: 'utf8' });
return output.replace(/\r?\n/g, '');
} catch (ex) {
return 'python';
}
}

private mountReactControl(mount: () => ReactWrapper<any, Readonly<{}>, React.Component>) {
// This is a remount (or first time). Clear out messages that were sent
// by the last mount
Expand Down
46 changes: 45 additions & 1 deletion src/test/datascience/interactiveWindow.functional.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { defaultDataScienceSettings } from './helpers';
import { addCode, getInteractiveCellResults, getOrCreateInteractiveWindow, runMountedTest } from './interactiveWindowTestHelpers';
import { MockDocumentManager } from './mockDocumentManager';
import { MockEditor } from './mockTextEditor';
import { waitForUpdate } from './reactHelpers';
import { createMessageEvent, waitForUpdate } from './reactHelpers';
import {
addContinuousMockData,
addInputMockData,
Expand All @@ -36,9 +36,12 @@ import {
enterInput,
escapePath,
findButton,
getInteractiveEditor,
getLastOutputCell,
srcDirectory,
submitInput,
toggleCellExpansion,
typeCode,
verifyHtmlOnCell,
verifyLastCellInputState,
waitForMessage,
Expand Down Expand Up @@ -143,6 +146,47 @@ suite('DataScience Interactive Window output tests', () => {
}
);

runMountedTest(
'Ctrl + 1/Ctrl + 2',
async wrapper => {
// Create an interactive window so that it listens to the results.
const interactiveWindow = await getOrCreateInteractiveWindow(ioc);
await interactiveWindow.show();

// Type in the input box
const editor = getInteractiveEditor(wrapper);
typeCode(editor, 'a=1\na');

// Give focus to a random div
const reactDiv = wrapper
.find('div')
.first()
.getDOMNode();

const domDiv = reactDiv.querySelector('div');

if (domDiv && ioc.postMessage) {
domDiv.tabIndex = -1;
domDiv.focus();

// send the ctrl + 1/2 message, this should put focus back on the input box
const message = createMessageEvent({ type: InteractiveWindowMessages.Activate, payload: undefined });
ioc.postMessage(message);

// Then enter press shift + enter on the active element
const activeElement = document.activeElement;
if (activeElement) {
await submitInput(ioc, activeElement as HTMLTextAreaElement);
}
}

verifyHtmlOnCell(wrapper, 'InteractiveCell', '<span>1</span>', CellPosition.Last);
},
() => {
return ioc;
}
);

runMountedTest(
'Collapse / expand cell',
async wrapper => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/datascience/testHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export function simulateKey(domNode: HTMLTextAreaElement, key: string, shiftDown
}
}

async function submitInput(ioc: DataScienceIocContainer, textArea: HTMLTextAreaElement): Promise<void> {
export async function submitInput(ioc: DataScienceIocContainer, textArea: HTMLTextAreaElement): Promise<void> {
// Get a render promise with the expected number of renders (how many updates a the shift + enter will cause)
// Should be 6 - 1 for the shift+enter and 5 for the new cell.
const renderPromise = waitForMessage(ioc, InteractiveWindowMessages.ExecutionRendered);
Expand Down