mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add setting for collapsing/expanding books at root level (#11543)
* Add setting for max number of expanded books * Remove extra commas * Add setting for expanding/collapsing books at root level * Change typo in name of setting * Change default value to false
This commit is contained in:
@@ -17,6 +17,11 @@
|
||||
"type": "object",
|
||||
"title": "%notebook.configuration.title%",
|
||||
"properties": {
|
||||
"notebook.collapseBookItems": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%notebook.collapseBookItems.description%"
|
||||
},
|
||||
"notebook.maxBookSearchDepth": {
|
||||
"type": "number",
|
||||
"default": 10,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"notebook.maxTableRows.description": "Maximum number of rows returned per table in the Notebook editor",
|
||||
"notebook.trustedBooks.description": "Notebooks contained in these books will automatically be trusted.",
|
||||
"notebook.maxBookSearchDepth.description": "Maximum depth of subdirectories to search for Books (Enter 0 for infinite)",
|
||||
"notebook.collapseBookItems.description": "Collapse Book items at root level in the Notebooks Viewlet",
|
||||
"notebook.remoteBookDownloadTimeout.description": "Download timeout in milliseconds for GitHub books",
|
||||
"notebook.command.new": "New Notebook",
|
||||
"notebook.command.open": "Open Notebook",
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as yaml from 'js-yaml';
|
||||
import { BookTreeItem, BookTreeItemType } from './bookTreeItem';
|
||||
import * as constants from '../common/constants';
|
||||
import * as path from 'path';
|
||||
import * as fileServices from 'fs';
|
||||
import * as fs from 'fs-extra';
|
||||
@@ -102,6 +103,12 @@ export class BookModel {
|
||||
if (this.isNotebook) {
|
||||
return undefined;
|
||||
}
|
||||
let notebookConfig = vscode.workspace.getConfiguration(constants.notebookConfigKey);
|
||||
let collapsedItems = notebookConfig[constants.collapseBookItems];
|
||||
let collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
|
||||
if (collapsedItems) {
|
||||
collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
|
||||
}
|
||||
|
||||
if (this._tableOfContentsPath) {
|
||||
let root: string = path.dirname(path.dirname(this._tableOfContentsPath));
|
||||
@@ -117,7 +124,7 @@ export class BookModel {
|
||||
tableOfContents: { sections: this.parseJupyterSections(tableOfContents) },
|
||||
page: tableOfContents,
|
||||
type: BookTreeItemType.Book,
|
||||
treeItemCollapsibleState: vscode.TreeItemCollapsibleState.Expanded,
|
||||
treeItemCollapsibleState: collapsibleState,
|
||||
isUntitled: this.openAsUntitled,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ export const notebookConfigKey = 'notebook';
|
||||
export const trustedBooksConfigKey = 'trustedBooks';
|
||||
export const maxBookSearchDepth = 'maxBookSearchDepth';
|
||||
export const remoteBookDownloadTimeout = 'remoteBookDownloadTimeout';
|
||||
export const collapseBookItems = 'collapseBookItems';
|
||||
|
||||
export const winPlatform = 'win32';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user