mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Show book's notebook TOC title in pinned notebooks view (#15583)
* Show notebook title in pinned notebooks view * fix test * change interface name
This commit is contained in:
@@ -435,7 +435,7 @@ export async function getRandomToken(size: number = 24): Promise<string> {
|
||||
}
|
||||
|
||||
export function isBookItemPinned(notebookPath: string): boolean {
|
||||
let pinnedNotebooks: IBookNotebook[] = getPinnedNotebooks();
|
||||
let pinnedNotebooks: IPinnedNotebook[] = getPinnedNotebooks();
|
||||
if (pinnedNotebooks?.find(x => x.notebookPath === notebookPath)) {
|
||||
return true;
|
||||
}
|
||||
@@ -451,16 +451,16 @@ export function getNotebookType(book: BookTreeItemFormat): BookTreeItemType {
|
||||
}
|
||||
}
|
||||
|
||||
export function getPinnedNotebooks(): IBookNotebook[] {
|
||||
export function getPinnedNotebooks(): IPinnedNotebook[] {
|
||||
let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(notebookConfigKey);
|
||||
let pinnedNotebooks: [] = config.get(pinnedBooksConfigKey);
|
||||
let updateFormat: boolean = false;
|
||||
const pinnedBookDirectories = pinnedNotebooks.map(elem => {
|
||||
if (typeof (elem) === 'string') {
|
||||
updateFormat = true;
|
||||
return { notebookPath: elem, bookPath: '' };
|
||||
return { notebookPath: elem, bookPath: '', title: '' };
|
||||
} else {
|
||||
return elem as IBookNotebook;
|
||||
return elem as IPinnedNotebook;
|
||||
}
|
||||
});
|
||||
if (updateFormat) {
|
||||
@@ -475,7 +475,7 @@ function hasWorkspaceFolders(): boolean {
|
||||
return workspaceFolders && workspaceFolders.length > 0;
|
||||
}
|
||||
|
||||
export async function setPinnedBookPathsInConfig(pinnedNotebookPaths: IBookNotebook[]): Promise<void> {
|
||||
export async function setPinnedBookPathsInConfig(pinnedNotebookPaths: IPinnedNotebook[]): Promise<void> {
|
||||
let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(notebookConfigKey);
|
||||
let storeInWorspace: boolean = hasWorkspaceFolders();
|
||||
|
||||
@@ -483,8 +483,9 @@ export async function setPinnedBookPathsInConfig(pinnedNotebookPaths: IBookNoteb
|
||||
}
|
||||
|
||||
|
||||
export interface IBookNotebook {
|
||||
export interface IPinnedNotebook {
|
||||
bookPath?: string;
|
||||
title?: string;
|
||||
notebookPath: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user