Skip to content

Commit 62bc5d0

Browse files
authored
Port run by line stop becoming interrupt to the release branch (#12271)
* 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 * Update changelog
1 parent 945d896 commit 62bc5d0

File tree

6 files changed

+40
-15
lines changed

6 files changed

+40
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
([#12193](https://github.com/Microsoft/vscode-python/issues/12193))
9595
1. Fix debugger continue event to actually change a cell.
9696
([#12155](https://github.com/Microsoft/vscode-python/issues/12155))
97+
1. Make stop during run by line interrupt the kernel.
98+
([#12249](https://github.com/Microsoft/vscode-python/issues/12249))
9799

98100
### Code Health
99101

package.nls.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,11 @@
506506
"StartPage.helloWorld": "Hello world",
507507
"StartPage.sampleNotebook": "Welcome_To_VSCode_Notebooks.ipynb",
508508
"DataScience.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreter": "{0} requires {1} to be installed.",
509-
"DataScience.runByLine": "Run by line",
510-
"DataScience.continueRunByLine": "Stop",
509+
"DataScience.runByLine": "Run by line (F10)",
510+
"DataScience.stopRunByLine": "Stop",
511511
"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.",
512512
"DataScience.rawKernelSessionFailed": "Unable to start session for kernel {0}. Select another kernel to launch with.",
513513
"DataScience.rawKernelConnectingSession": "Connecting to kernel.",
514-
"DataScience.reloadCustomEditor": "Please reload VS Code to use the custom editor API"
514+
"DataScience.reloadCustomEditor": "Please reload VS Code to use the custom editor API",
515+
"DataScience.step": "Run next line (F10)"
515516
}

src/client/common/utils/localize.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,9 @@ export namespace DataScience {
937937
);
938938

939939
export const kernelStarted = localize('DataScience.kernelStarted', 'Started kernel {0}.');
940-
export const runByLine = localize('DataScience.runByLine', 'Run by line');
941-
export const continueRunByLine = localize('DataScience.continueRunByLine', 'Stop');
940+
export const runByLine = localize('DataScience.runByLine', 'Run by line (F10)');
941+
export const step = localize('DataScience.step', 'Run next line (F10)');
942+
export const stopRunByLine = localize('DataScience.stopRunByLine', 'Stop');
942943
export const rawKernelSessionFailed = localize(
943944
'DataScience.rawKernelSessionFailed',
944945
'Unable to start session for kernel {0}. Select another kernel to launch with.'

src/datascience-ui/native-editor/nativeCell.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ import { IMonacoModelContentChangeEvent } from '../react-common/monacoHelpers';
3131
import { AddCellLine } from './addCellLine';
3232
import { actionCreators } from './redux/actions';
3333

34-
import { CodIcon } from '../react-common/codicon/codicon';
35-
import '../react-common/codicon/codicon.css';
36-
3734
namespace CssConstants {
3835
export const CellOutputWrapper = 'cell-output-wrapper';
3936
export const CellOutputWrapperClass = `.${CellOutputWrapper}`;
@@ -577,8 +574,8 @@ export class NativeCell extends React.Component<INativeCellProps> {
577574
this.props.focusCell(cellId);
578575
this.props.runByLine(cellId);
579576
};
580-
const cont = () => {
581-
this.props.continue(cellId);
577+
const stop = () => {
578+
this.props.interruptKernel();
582579
};
583580
const step = () => {
584581
this.props.focusCell(cellId);
@@ -616,18 +613,19 @@ export class NativeCell extends React.Component<INativeCellProps> {
616613
<div className={toolbarClassName}>
617614
<div className="native-editor-celltoolbar-middle">
618615
<ImageButton
616+
className={'image-button-empty'} // Just takes up space for now
619617
baseTheme={this.props.baseTheme}
620-
onClick={cont}
621-
tooltip={getLocString('DataScience.continueRunByLine', 'Stop')}
618+
onClick={runCell}
619+
tooltip={getLocString('DataScience.runCell', 'Run cell')}
622620
hidden={this.isMarkdownCell()}
623-
disabled={this.props.busy || this.props.runningByLine === DebugState.Run}
621+
disabled={true}
624622
>
625-
<div className="codicon codicon-button">{CodIcon.Stop}</div>
623+
<Image baseTheme={this.props.baseTheme} class="image-button-image" image={ImageName.Run} />
626624
</ImageButton>
627625
<ImageButton
628626
baseTheme={this.props.baseTheme}
629627
onClick={step}
630-
tooltip={getLocString('DataScience.step', 'Run next line')}
628+
tooltip={getLocString('DataScience.step', 'Run next line (F10)')}
631629
hidden={this.isMarkdownCell()}
632630
disabled={this.props.busy || this.props.runningByLine === DebugState.Run}
633631
>
@@ -637,6 +635,19 @@ export class NativeCell extends React.Component<INativeCellProps> {
637635
image={ImageName.RunByLine}
638636
/>
639637
</ImageButton>
638+
<ImageButton
639+
baseTheme={this.props.baseTheme}
640+
onClick={stop}
641+
tooltip={getLocString('DataScience.stopRunByLine', 'Stop')}
642+
hidden={this.isMarkdownCell()}
643+
disabled={false}
644+
>
645+
<Image
646+
baseTheme={this.props.baseTheme}
647+
class="image-button-image"
648+
image={ImageName.Interrupt}
649+
/>
650+
</ImageButton>
640651
</div>
641652
<div className="native-editor-celltoolbar-divider" />
642653
</div>

src/datascience-ui/native-editor/nativeEditor.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ ${buildSettingsCss(this.props.settings)}`}</style>
237237
this.props.step(debuggingCell.cell.id);
238238
}
239239
event.stopPropagation();
240+
} else {
241+
// Otherwise if not debugging, run by line the current focused cell
242+
const focusedCell = getSelectedAndFocusedInfo(this.props).focusedCellId;
243+
if (focusedCell) {
244+
this.props.runByLine(focusedCell);
245+
}
240246
}
241247
break;
242248
case 'F5':

src/datascience-ui/react-common/imageButton.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
cursor: hand;
1717
}
1818

19+
.image-button-empty {
20+
visibility: hidden;
21+
}
22+
1923
.image-button-inner-disabled-filter {
2024
opacity: 0.5;
2125
}

0 commit comments

Comments
 (0)