mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add run cells as a command (#5080)
This commit is contained in:
@@ -39,6 +39,9 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runactivecell', () => {
|
||||
runActiveCell();
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runallcells', () => {
|
||||
runAllCells();
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcell', async () => {
|
||||
let cellType: CellType;
|
||||
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> {
|
||||
try {
|
||||
let notebook = azdata.nb.activeNotebookEditor;
|
||||
|
||||
Reference in New Issue
Block a user