mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add notebook open protocol handler (#6093)
Adds a protocol handler for notebook open, which can be used from browsers Uses extension-based handler support so all URIs must start with `azuredatastudio://microsoft.notebook` Adds 2 actions: - `/new` opens a new empty notebook - `/open` opens a HTTP/S file as an untitled notebook or text document Sample URL: ``` azuredatastudio://microsoft.notebook/open?url=https%3A%2F%2Fraw.githubusercontent.com%2Fkevcunnane%2Fmsbuild_ads_demo%2Fmaster%2F0_YoAzdata.ipynb ```
This commit is contained in:
@@ -7,6 +7,7 @@ import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -135,3 +136,9 @@ function outputDataChunk(data: string | Buffer, outputChannel: vscode.OutputChan
|
||||
outputChannel.appendLine(header + line);
|
||||
});
|
||||
}
|
||||
|
||||
export function isEditorTitleFree(title: string): boolean {
|
||||
let hasTextDoc = vscode.workspace.textDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1;
|
||||
let hasNotebookDoc = azdata.nb.notebookDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1;
|
||||
return !hasTextDoc && !hasNotebookDoc;
|
||||
}
|
||||
Reference in New Issue
Block a user