mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Redirect vscode New Jupyter Notebook command (#24520)
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"vscode": "^1.57.0"
|
||||
"vscode": "^1.57.0",
|
||||
"azdata": "*"
|
||||
},
|
||||
"enabledApiProposals": [
|
||||
"documentPaste",
|
||||
@@ -14,7 +15,7 @@
|
||||
"dropMetadata"
|
||||
],
|
||||
"activationEvents": [
|
||||
"*"
|
||||
"onNotebook:jupyter-notebook"
|
||||
],
|
||||
"extensionKind": [
|
||||
"workspace",
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata'; // {{SQL CARBON EDIT}}
|
||||
import { NotebookSerializer } from './notebookSerializer';
|
||||
import { ensureAllNewCellsHaveCellIds } from './cellIdService';
|
||||
import { notebookImagePasteSetup } from './notebookImagePaste';
|
||||
@@ -58,6 +59,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
});
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('ipynb.newUntitledIpynb', async () => {
|
||||
// {{SQL CARBON EDIT}} Open new notebooks using the default ADS notebook viewer if VSCode notebooks aren't enabled.
|
||||
let useVSCodeNotebooks = vscode.workspace.getConfiguration('workbench')?.get<boolean>('useVSCodeNotebooks');
|
||||
if (useVSCodeNotebooks) {
|
||||
const language = 'python';
|
||||
const cell = new vscode.NotebookCellData(vscode.NotebookCellKind.Code, '', language);
|
||||
const data = new vscode.NotebookData([cell]);
|
||||
@@ -73,6 +77,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
};
|
||||
const doc = await vscode.workspace.openNotebookDocument('jupyter-notebook', data);
|
||||
await vscode.window.showNotebookDocument(doc);
|
||||
} else {
|
||||
await azdata.nb.showNotebookDocument(vscode.Uri.from({ scheme: 'untitled' }));
|
||||
}
|
||||
}));
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('ipynb.openIpynbInNotebookEditor', async (uri: vscode.Uri) => {
|
||||
|
||||
10
extensions/ipynb/src/typings/refs.d.ts
vendored
Normal file
10
extensions/ipynb/src/typings/refs.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// {{SQL CARBON EDIT}} Import ADS extension APIs
|
||||
/// <reference path='../../../../src/sql/azdata.d.ts'/>
|
||||
/// <reference path='../../../../src/sql/azdata.proposed.d.ts'/>
|
||||
/// <reference path='../../../../src/vscode-dts/vscode.d.ts'/>
|
||||
/// <reference path='../../../resource-deployment/src/typings/resource-deployment.d.ts'/>
|
||||
Reference in New Issue
Block a user