mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Display error when doing notebook convert (#13438)
* Display error when doing notebook convert * Update STS
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "3.0.0-release.52",
|
"version": "3.0.0-release.56",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-netcoreapp3.1.zip",
|
"Windows_86": "win-x86-netcoreapp3.1.zip",
|
||||||
"Windows_64": "win-x64-netcoreapp3.1.zip",
|
"Windows_64": "win-x64-netcoreapp3.1.zip",
|
||||||
|
|||||||
@@ -81,13 +81,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
|||||||
await server.start(appContext);
|
await server.start(appContext);
|
||||||
|
|
||||||
vscode.commands.registerCommand('mssql.exportSqlAsNotebook', async (uri: vscode.Uri) => {
|
vscode.commands.registerCommand('mssql.exportSqlAsNotebook', async (uri: vscode.Uri) => {
|
||||||
|
try {
|
||||||
const result = await appContext.getService<INotebookConvertService>(Constants.NotebookConvertService).convertSqlToNotebook(uri.toString());
|
const result = await appContext.getService<INotebookConvertService>(Constants.NotebookConvertService).convertSqlToNotebook(uri.toString());
|
||||||
const title = findNextUntitledEditorName();
|
const title = findNextUntitledEditorName();
|
||||||
const untitledUri = vscode.Uri.parse(`untitled:${title}`);
|
const untitledUri = vscode.Uri.parse(`untitled:${title}`);
|
||||||
await azdata.nb.showNotebookDocument(untitledUri, { initialContent: result.content });
|
await azdata.nb.showNotebookDocument(untitledUri, { initialContent: result.content });
|
||||||
|
} catch (err) {
|
||||||
|
vscode.window.showErrorMessage(localize('mssql.errorConvertingToNotebook', "An error occurred converting the SQL document to a Notebook. Error : {0}", err.toString()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vscode.commands.registerCommand('mssql.exportNotebookToSql', async (uri: vscode.Uri) => {
|
vscode.commands.registerCommand('mssql.exportNotebookToSql', async (uri: vscode.Uri) => {
|
||||||
|
try {
|
||||||
// SqlToolsService doesn't currently store anything about Notebook documents so we have to pass the raw JSON to it directly
|
// SqlToolsService doesn't currently store anything about Notebook documents so we have to pass the raw JSON to it directly
|
||||||
// We use vscode.workspace.textDocuments here because the azdata.nb.notebookDocuments don't actually contain their contents
|
// We use vscode.workspace.textDocuments here because the azdata.nb.notebookDocuments don't actually contain their contents
|
||||||
// (they're left out for perf purposes)
|
// (they're left out for perf purposes)
|
||||||
@@ -96,6 +101,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
|||||||
|
|
||||||
const sqlDoc = await vscode.workspace.openTextDocument({ language: 'sql', content: result.content });
|
const sqlDoc = await vscode.workspace.openTextDocument({ language: 'sql', content: result.content });
|
||||||
await vscode.commands.executeCommand('vscode.open', sqlDoc.uri);
|
await vscode.commands.executeCommand('vscode.open', sqlDoc.uri);
|
||||||
|
} catch (err) {
|
||||||
|
vscode.window.showErrorMessage(localize('mssql.errorConvertingToSQL', "An error occurred converting the Notebook document to SQL. Error : {0}", err.toString()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return createMssqlApi(appContext);
|
return createMssqlApi(appContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user