mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix open notebook bug (#10930)
* Fix open notebook bug * cleanup * clean up spaces
This commit is contained in:
@@ -16,7 +16,6 @@ import { CellType } from './contracts/content';
|
||||
import { NotebookUriHandler } from './protocol/notebookUriHandler';
|
||||
import { BookTreeViewProvider } from './book/bookTreeView';
|
||||
import { NavigationProviders } from './common/constants';
|
||||
import { newNotebook, openNotebook, runActiveCell, runAllCells, clearActiveCellOutput, addCell, analyzeNotebook } from './common/notebookUtils';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -26,6 +25,7 @@ let controller: JupyterController;
|
||||
type ChooseCellType = { label: string, id: CellType };
|
||||
|
||||
export async function activate(extensionContext: vscode.ExtensionContext): Promise<IExtensionApi> {
|
||||
const appContext = new AppContext(extensionContext, new ApiWrapper());
|
||||
const createBookPath: string = path.posix.join(extensionContext.extensionPath, 'resources', 'notebooks', 'JupyterBooksCreate.ipynb');
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('bookTreeView.openBook', (bookPath: string, openAsUntitled: boolean, urlToOpen?: string) => openAsUntitled ? providedBookTreeViewProvider.openBook(bookPath, urlToOpen, true) : bookTreeViewProvider.openBook(bookPath, urlToOpen, true)));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('bookTreeView.openNotebook', (resource) => bookTreeViewProvider.openNotebook(resource)));
|
||||
@@ -56,19 +56,19 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
|
||||
if (context && context.connectionProfile) {
|
||||
connectionProfile = context.connectionProfile;
|
||||
}
|
||||
return newNotebook(connectionProfile);
|
||||
return appContext.notebookUtils.newNotebook(connectionProfile);
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.open', async () => {
|
||||
await openNotebook();
|
||||
await appContext.notebookUtils.openNotebook();
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runactivecell', async () => {
|
||||
await runActiveCell();
|
||||
await appContext.notebookUtils.runActiveCell();
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runallcells', async () => {
|
||||
await runAllCells();
|
||||
await appContext.notebookUtils.runAllCells();
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.clearactivecellresult', async () => {
|
||||
await clearActiveCellOutput();
|
||||
await appContext.notebookUtils.clearActiveCellOutput();
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcell', async () => {
|
||||
let cellType: CellType;
|
||||
@@ -91,17 +91,17 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
|
||||
return;
|
||||
}
|
||||
if (cellType) {
|
||||
await addCell(cellType);
|
||||
await appContext.notebookUtils.addCell(cellType);
|
||||
}
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcode', async () => {
|
||||
await addCell('code');
|
||||
await appContext.notebookUtils.addCell('code');
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addtext', async () => {
|
||||
await addCell('markdown');
|
||||
await appContext.notebookUtils.addCell('markdown');
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.analyzeNotebook', async (explorerContext: azdata.ObjectExplorerContext) => {
|
||||
await analyzeNotebook(explorerContext);
|
||||
await appContext.notebookUtils.analyzeNotebook(explorerContext);
|
||||
}));
|
||||
extensionContext.subscriptions.push(vscode.window.registerUriHandler(new NotebookUriHandler()));
|
||||
|
||||
@@ -110,7 +110,6 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
|
||||
await vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(urlToOpen));
|
||||
}));
|
||||
|
||||
let appContext = new AppContext(extensionContext, new ApiWrapper());
|
||||
controller = new JupyterController(appContext);
|
||||
let result = await controller.activate();
|
||||
if (!result) {
|
||||
|
||||
Reference in New Issue
Block a user