Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Running an empty cell should not put an empty cell into the interactive window #6844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 6, 2019
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
1 change: 1 addition & 0 deletions news/2 Fixes/6839.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not execute empty code cells or render them in the interactive window when sent from the editor or input box
10 changes: 9 additions & 1 deletion src/client/datascience/interactive-window/interactiveWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
ISubmitNewCell,
SysInfoReason
} from './interactiveWindowTypes';
import { CellMatcher } from '../cellMatcher';

@injectable()
export class InteractiveWindow extends WebViewHost<IInteractiveWindowMapping> implements IInteractiveWindow {
Expand Down Expand Up @@ -744,8 +745,15 @@ export class InteractiveWindow extends WebViewHost<IInteractiveWindowMapping> im
}

private async submitCode(code: string, file: string, line: number, id?: string, _editor?: TextEditor, debug?: boolean): Promise<boolean> {
traceInfo(`Submitting code for ${this.id}`);
let result = true;

// Do not execute or render empty code cells
const cellMatcher = new CellMatcher(this.configService.getSettings().datascience);
if (cellMatcher.stripFirstMarker(code).length === 0) {
return result;
}

traceInfo(`Submitting code for ${this.id}`);
// Start a status item
const status = this.setStatus(localize.DataScience.executingCode());

Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/webViewHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class WebViewHost<IMapping> implements IDisposable {
private startupStopwatch = new StopWatch();

constructor(
@unmanaged() private configService: IConfigurationService,
@unmanaged() protected configService: IConfigurationService,
@unmanaged() private provider: IWebPanelProvider,
@unmanaged() private cssGenerator: ICodeCssGenerator,
@unmanaged() protected themeFinder: IThemeFinder,
Expand Down
Loading