mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 01:25:38 -05:00
Pinning Notebooks on Notebooks view (#11963)
* initial commit * added tests * code cleanup and more tests * add missed util test * changes to address comments * remove pin from resources
This commit is contained in:
@@ -9,7 +9,7 @@ import * as nls from 'vscode-nls';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as crypto from 'crypto';
|
||||
import { notebookLanguages } from './constants';
|
||||
import { notebookLanguages, notebookConfigKey, pinnedBooksConfigKey } from './constants';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -323,3 +323,18 @@ export async function getRandomToken(size: number = 24): Promise<string> {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function isBookItemPinned(notebookPath: string): boolean {
|
||||
let pinnedNotebooks: string[] = getPinnedNotebooks();
|
||||
if (pinnedNotebooks?.indexOf(notebookPath) > -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getPinnedNotebooks(): string[] {
|
||||
let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(notebookConfigKey);
|
||||
let pinnedNotebooks: string[] = config.get(pinnedBooksConfigKey) ?? [];
|
||||
|
||||
return pinnedNotebooks;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user