mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 01:32:34 -05:00
* initial * more * Remove connectionId * cleanup * cleanup * Remove core contributions, add to panel by default * Add enabled state * Update config * cleanup * Move * Remove newlines * update README
42 lines
2.0 KiB
TypeScript
42 lines
2.0 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as azdata from 'azdata';
|
|
import * as vscode from 'vscode';
|
|
import { QueryHistoryNode } from './queryHistoryNode';
|
|
import { QueryHistoryProvider } from './queryHistoryProvider';
|
|
|
|
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
|
const provider = new QueryHistoryProvider();
|
|
context.subscriptions.push(provider);
|
|
context.subscriptions.push(vscode.window.registerTreeDataProvider('queryHistory', provider));
|
|
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.open', async (node: QueryHistoryNode) => {
|
|
return azdata.queryeditor.openQueryDocument(
|
|
{
|
|
content: node.queryText
|
|
}, node.connectionProfile?.providerId);
|
|
}));
|
|
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.run', async (node: QueryHistoryNode) => {
|
|
const doc = await azdata.queryeditor.openQueryDocument(
|
|
{
|
|
content: node.queryText
|
|
}, node.connectionProfile?.providerId);
|
|
await azdata.queryeditor.connect(doc.uri, node.connectionProfile?.connectionId || '');
|
|
azdata.queryeditor.runQuery(doc.uri);
|
|
}));
|
|
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.delete', (node: QueryHistoryNode) => {
|
|
provider.deleteNode(node);
|
|
}));
|
|
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.clear', () => {
|
|
provider.clearAll();
|
|
}));
|
|
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.disableCapture', async () => {
|
|
return provider.setCaptureEnabled(false);
|
|
}));
|
|
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.enableCapture', async () => {
|
|
return provider.setCaptureEnabled(true);
|
|
}));
|
|
}
|