mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Move query history into extension (#19794)
* 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
This commit is contained in:
@@ -3,15 +3,39 @@
|
||||
* 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> {
|
||||
// Currently all the functionality for this is contained within the core ADS
|
||||
// code as the extensibility API doesn't currently support all the required
|
||||
// functionality (such as contributing tab panels)
|
||||
void vscode.commands.executeCommand('queryHistory.enableQueryHistory');
|
||||
}
|
||||
|
||||
export async function deactivate(): 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);
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user