Skip to content
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

Add support for running an entire file whether or not it has cells #3938

Merged
merged 2 commits into from
Jan 9, 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/3362.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for running an entire file in the Python Interactive window
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
},
{
"command": "python.datascience.runallcells",
"title": "%python.command.python.datascience.runallcells.title%",
"title": "%python.command.python.datascience.runallcells.command.title%",
"category": "Python"
},
{
Expand Down Expand Up @@ -433,7 +433,7 @@
},
{
"command": "python.datascience.runallcells",
"title": "%python.command.python.datascience.runallcells.title%",
"title": "%python.command.python.datascience.runallcells.command.title%",
"category": "Python",
"when": "python.datascience.featureenabled"
},
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"python.command.python.setLinter.title": "Select Linter",
"python.command.python.enableLinting.title": "Enable Linting",
"python.command.python.runLinting.title": "Run Linting",
"python.command.python.datascience.runallcells.command.title": "Run Current File in Python Interactive window",
"python.command.python.datascience.runallcells.title": "Run All Cells",
"python.command.python.datascience.runcurrentcell.title": "Run Current Cell",
"python.command.python.datascience.runcurrentcelladvance.title": "Run Current Cell And Advance",
Expand Down
8 changes: 8 additions & 0 deletions src/client/datascience/editor-integration/codewatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export class CodeWatcher implements ICodeWatcher {
}
}
}

// If there are no codelenses, just run all of the code as a single cell
if (this.codeLenses.length === 0) {
if (this.document) {
const code = this.document.getText();
await activeHistory.addCode(code, this.getFileName(), 0);
}
}
}

@captureTelemetry(Telemetry.RunCell)
Expand Down
3 changes: 3 additions & 0 deletions src/datascience-ui/history-react/cell.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
background: var(--vscode-notifications-background);
white-space: pre-wrap;
font-family: monospace;
max-height: 300px;
overflow-y: auto;
overflow-x: auto;
}

.cell-output pre {
Expand Down