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:
Maddy
2020-08-31 08:53:11 -07:00
committed by GitHub
parent b4a3325a21
commit ae830d9e64
15 changed files with 506 additions and 26 deletions

View File

@@ -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;
}