From f6ec9083a310c88949aeb57f84b2a50d04f52d8e Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 10 Jun 2020 10:26:09 -0700 Subject: [PATCH 1/2] Run by line changes for release (#12256) * Run by line changes for release * Translate step tooltip and make sure F10 works outside of already debugging --- news/1 Enhancements/12249.md | 1 + package.nls.json | 7 +++-- src/client/common/utils/localize.ts | 5 +-- .../native-editor/nativeCell.tsx | 31 +++++++++++++------ .../native-editor/nativeEditor.tsx | 6 ++++ .../react-common/imageButton.css | 4 +++ 6 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 news/1 Enhancements/12249.md diff --git a/news/1 Enhancements/12249.md b/news/1 Enhancements/12249.md new file mode 100644 index 000000000000..337713c16a11 --- /dev/null +++ b/news/1 Enhancements/12249.md @@ -0,0 +1 @@ +Make stop during run by line interrupt the kernel. \ No newline at end of file diff --git a/package.nls.json b/package.nls.json index 92d924071f11..fb3aa83dc05a 100644 --- a/package.nls.json +++ b/package.nls.json @@ -506,10 +506,11 @@ "StartPage.helloWorld": "Hello world", "StartPage.sampleNotebook": "Welcome_To_VSCode_Notebooks.ipynb", "DataScience.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreter": "{0} requires {1} to be installed.", - "DataScience.runByLine": "Run by line", - "DataScience.continueRunByLine": "Stop", + "DataScience.runByLine": "Run by line (F10)", + "DataScience.stopRunByLine": "Stop", "DataScience.couldNotInstallLibrary": "Could not install {0}. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.", "DataScience.rawKernelSessionFailed": "Unable to start session for kernel {0}. Select another kernel to launch with.", "DataScience.rawKernelConnectingSession": "Connecting to kernel.", - "DataScience.reloadCustomEditor": "Please reload VS Code to use the custom editor API" + "DataScience.reloadCustomEditor": "Please reload VS Code to use the custom editor API", + "DataScience.step": "Run next line (F10)" } diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index cd45f364b6dd..5053b51d24dc 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -937,8 +937,9 @@ export namespace DataScience { ); export const kernelStarted = localize('DataScience.kernelStarted', 'Started kernel {0}.'); - export const runByLine = localize('DataScience.runByLine', 'Run by line'); - export const continueRunByLine = localize('DataScience.continueRunByLine', 'Stop'); + export const runByLine = localize('DataScience.runByLine', 'Run by line (F10)'); + export const step = localize('DataScience.step', 'Run next line (F10)'); + export const stopRunByLine = localize('DataScience.stopRunByLine', 'Stop'); export const rawKernelSessionFailed = localize( 'DataScience.rawKernelSessionFailed', 'Unable to start session for kernel {0}. Select another kernel to launch with.' diff --git a/src/datascience-ui/native-editor/nativeCell.tsx b/src/datascience-ui/native-editor/nativeCell.tsx index b0aebd5b614e..6e8f920130e4 100644 --- a/src/datascience-ui/native-editor/nativeCell.tsx +++ b/src/datascience-ui/native-editor/nativeCell.tsx @@ -31,9 +31,6 @@ import { IMonacoModelContentChangeEvent } from '../react-common/monacoHelpers'; import { AddCellLine } from './addCellLine'; import { actionCreators } from './redux/actions'; -import { CodIcon } from '../react-common/codicon/codicon'; -import '../react-common/codicon/codicon.css'; - namespace CssConstants { export const CellOutputWrapper = 'cell-output-wrapper'; export const CellOutputWrapperClass = `.${CellOutputWrapper}`; @@ -577,8 +574,8 @@ export class NativeCell extends React.Component { this.props.focusCell(cellId); this.props.runByLine(cellId); }; - const cont = () => { - this.props.continue(cellId); + const stop = () => { + this.props.interruptKernel(); }; const step = () => { this.props.focusCell(cellId); @@ -616,18 +613,19 @@ export class NativeCell extends React.Component {
+
diff --git a/src/datascience-ui/native-editor/nativeEditor.tsx b/src/datascience-ui/native-editor/nativeEditor.tsx index 1fb88322a22b..6fbb6143548d 100644 --- a/src/datascience-ui/native-editor/nativeEditor.tsx +++ b/src/datascience-ui/native-editor/nativeEditor.tsx @@ -237,6 +237,12 @@ ${buildSettingsCss(this.props.settings)}`} this.props.step(debuggingCell.cell.id); } event.stopPropagation(); + } else { + // Otherwise if not debugging, run by line the current focused cell + const focusedCell = getSelectedAndFocusedInfo(this.props).focusedCellId; + if (focusedCell) { + this.props.runByLine(focusedCell); + } } break; case 'F5': diff --git a/src/datascience-ui/react-common/imageButton.css b/src/datascience-ui/react-common/imageButton.css index 96fa296aa8a5..1b47cd8b6d8e 100644 --- a/src/datascience-ui/react-common/imageButton.css +++ b/src/datascience-ui/react-common/imageButton.css @@ -16,6 +16,10 @@ cursor: hand; } +.image-button-empty { + visibility: hidden; +} + .image-button-inner-disabled-filter { opacity: 0.5; } From 9103646b73e457ddeb90db9a79a4ce70458caa52 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 10 Jun 2020 10:28:39 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ news/1 Enhancements/12249.md | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 news/1 Enhancements/12249.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d22fc7bb2aad..8dad773a9658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,8 @@ ([#12193](https://github.com/Microsoft/vscode-python/issues/12193)) 1. Fix debugger continue event to actually change a cell. ([#12155](https://github.com/Microsoft/vscode-python/issues/12155)) +1. Make stop during run by line interrupt the kernel. + ([#12249](https://github.com/Microsoft/vscode-python/issues/12249)) ### Code Health diff --git a/news/1 Enhancements/12249.md b/news/1 Enhancements/12249.md deleted file mode 100644 index 337713c16a11..000000000000 --- a/news/1 Enhancements/12249.md +++ /dev/null @@ -1 +0,0 @@ -Make stop during run by line interrupt the kernel. \ No newline at end of file