mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Update Query History README (#20716)
* Add max entries to query history * Update query history README
This commit is contained in:
@@ -21,14 +21,15 @@ const DOUBLE_CLICK_TIMEOUT_MS = 500;
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
||||
// Create the global storage folder now for storing the query history persistance file
|
||||
const storageUri = context.globalStorageUri;
|
||||
try {
|
||||
await fs.mkdir(context.globalStorageUri.fsPath);
|
||||
await fs.mkdir(storageUri.fsPath);
|
||||
} catch (err) {
|
||||
if (err.code !== 'EEXIST') {
|
||||
console.error(`Error creating query history global storage folder ${context.globalStorageUri.fsPath}. ${err}`);
|
||||
}
|
||||
}
|
||||
const treeDataProvider = new QueryHistoryProvider(context);
|
||||
const treeDataProvider = new QueryHistoryProvider(context, storageUri);
|
||||
context.subscriptions.push(treeDataProvider);
|
||||
const treeView = vscode.window.createTreeView('queryHistory', {
|
||||
treeDataProvider,
|
||||
@@ -83,6 +84,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
||||
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.enableCapture', async () => {
|
||||
return treeDataProvider.setCaptureEnabled(true);
|
||||
}));
|
||||
context.subscriptions.push(vscode.commands.registerCommand('queryHistory.openStorageFolder', async () => {
|
||||
return vscode.env.openExternal(storageUri);
|
||||
}));
|
||||
}
|
||||
|
||||
async function openQuery(item: QueryHistoryItem): Promise<void> {
|
||||
|
||||
@@ -45,8 +45,8 @@ export class QueryHistoryProvider implements vscode.TreeDataProvider<QueryHistor
|
||||
*/
|
||||
private queryTextMappings: Map<string, string> = new Map<string, string>();
|
||||
|
||||
constructor(private _context: vscode.ExtensionContext) {
|
||||
this._historyStorageFile = path.join(this._context.globalStorageUri.fsPath, HISTORY_STORAGE_FILE_NAME);
|
||||
constructor(private _context: vscode.ExtensionContext, storageUri: vscode.Uri) {
|
||||
this._historyStorageFile = path.join(storageUri.fsPath, HISTORY_STORAGE_FILE_NAME);
|
||||
// Kick off initialization but then continue on since that may take a while and we don't want to block extension activation
|
||||
void this.initialize();
|
||||
this._disposables.push(vscode.workspace.onDidChangeConfiguration(async e => {
|
||||
|
||||
Reference in New Issue
Block a user