mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add run cells as a command (#5080)
This commit is contained in:
@@ -60,6 +60,10 @@
|
|||||||
"title": "%notebook.command.runactivecell%",
|
"title": "%notebook.command.runactivecell%",
|
||||||
"icon": "resources/dark/touchbar_run_cell.png"
|
"icon": "resources/dark/touchbar_run_cell.png"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "notebook.command.runallcells",
|
||||||
|
"title": "%notebook.command.runallcells%"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "notebook.command.addcode",
|
"command": "notebook.command.addcode",
|
||||||
"title": "%notebook.command.addcode%"
|
"title": "%notebook.command.addcode%"
|
||||||
@@ -145,6 +149,10 @@
|
|||||||
"command": "notebook.command.runactivecell",
|
"command": "notebook.command.runactivecell",
|
||||||
"when": "notebookEditorVisible"
|
"when": "notebookEditorVisible"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "notebook.command.runallcells",
|
||||||
|
"when": "notebookEditorVisible"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "notebook.command.addcode",
|
"command": "notebook.command.addcode",
|
||||||
"when": "notebookEditorVisible"
|
"when": "notebookEditorVisible"
|
||||||
@@ -229,6 +237,11 @@
|
|||||||
"key": "F5",
|
"key": "F5",
|
||||||
"when": "activeEditor == workbench.editor.notebookEditor"
|
"when": "activeEditor == workbench.editor.notebookEditor"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "notebook.command.runallcells",
|
||||||
|
"key": "Ctrl+Shift+F5",
|
||||||
|
"when": "activeEditor == workbench.editor.notebookEditor"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "notebook.command.addcode",
|
"command": "notebook.command.addcode",
|
||||||
"key": "Ctrl+Shift+C",
|
"key": "Ctrl+Shift+C",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"notebook.command.open": "Open Notebook",
|
"notebook.command.open": "Open Notebook",
|
||||||
"notebook.analyzeJupyterNotebook": "Analyze in Notebook",
|
"notebook.analyzeJupyterNotebook": "Analyze in Notebook",
|
||||||
"notebook.command.runactivecell": "Run Cell",
|
"notebook.command.runactivecell": "Run Cell",
|
||||||
|
"notebook.command.runallcells": "Run Cells",
|
||||||
"notebook.command.addcode": "Add Code Cell",
|
"notebook.command.addcode": "Add Code Cell",
|
||||||
"notebook.command.addtext": "Add Text Cell",
|
"notebook.command.addtext": "Add Text Cell",
|
||||||
"notebook.command.addcell": "Add Cell",
|
"notebook.command.addcell": "Add Cell",
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
|
|||||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runactivecell', () => {
|
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runactivecell', () => {
|
||||||
runActiveCell();
|
runActiveCell();
|
||||||
}));
|
}));
|
||||||
|
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runallcells', () => {
|
||||||
|
runAllCells();
|
||||||
|
}));
|
||||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcell', async () => {
|
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcell', async () => {
|
||||||
let cellType: CellType;
|
let cellType: CellType;
|
||||||
try {
|
try {
|
||||||
@@ -149,6 +152,19 @@ async function runActiveCell(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function runAllCells(): Promise<void> {
|
||||||
|
try {
|
||||||
|
let notebook = azdata.nb.activeNotebookEditor;
|
||||||
|
if (notebook) {
|
||||||
|
await notebook.runAllCells();
|
||||||
|
} else {
|
||||||
|
throw new Error(noNotebookVisible);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
vscode.window.showErrorMessage(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function addCell(cellType: azdata.nb.CellType): Promise<void> {
|
async function addCell(cellType: azdata.nb.CellType): Promise<void> {
|
||||||
try {
|
try {
|
||||||
let notebook = azdata.nb.activeNotebookEditor;
|
let notebook = azdata.nb.activeNotebookEditor;
|
||||||
|
|||||||
Reference in New Issue
Block a user