mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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",
|
"type": "object",
|
||||||
"title": "%notebook.configuration.title%",
|
"title": "%notebook.configuration.title%",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"notebook.collapseBookItems": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "%notebook.collapseBookItems.description%"
|
||||||
|
},
|
||||||
"notebook.maxBookSearchDepth": {
|
"notebook.maxBookSearchDepth": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 10,
|
"default": 10,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"notebook.maxTableRows.description": "Maximum number of rows returned per table in the Notebook editor",
|
"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.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.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.remoteBookDownloadTimeout.description": "Download timeout in milliseconds for GitHub books",
|
||||||
"notebook.command.new": "New Notebook",
|
"notebook.command.new": "New Notebook",
|
||||||
"notebook.command.open": "Open Notebook",
|
"notebook.command.open": "Open Notebook",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
import { BookTreeItem, BookTreeItemType } from './bookTreeItem';
|
import { BookTreeItem, BookTreeItemType } from './bookTreeItem';
|
||||||
|
import * as constants from '../common/constants';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fileServices from 'fs';
|
import * as fileServices from 'fs';
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
@@ -102,6 +103,12 @@ export class BookModel {
|
|||||||
if (this.isNotebook) {
|
if (this.isNotebook) {
|
||||||
return undefined;
|
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) {
|
if (this._tableOfContentsPath) {
|
||||||
let root: string = path.dirname(path.dirname(this._tableOfContentsPath));
|
let root: string = path.dirname(path.dirname(this._tableOfContentsPath));
|
||||||
@@ -117,7 +124,7 @@ export class BookModel {
|
|||||||
tableOfContents: { sections: this.parseJupyterSections(tableOfContents) },
|
tableOfContents: { sections: this.parseJupyterSections(tableOfContents) },
|
||||||
page: tableOfContents,
|
page: tableOfContents,
|
||||||
type: BookTreeItemType.Book,
|
type: BookTreeItemType.Book,
|
||||||
treeItemCollapsibleState: vscode.TreeItemCollapsibleState.Expanded,
|
treeItemCollapsibleState: collapsibleState,
|
||||||
isUntitled: this.openAsUntitled,
|
isUntitled: this.openAsUntitled,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const notebookConfigKey = 'notebook';
|
|||||||
export const trustedBooksConfigKey = 'trustedBooks';
|
export const trustedBooksConfigKey = 'trustedBooks';
|
||||||
export const maxBookSearchDepth = 'maxBookSearchDepth';
|
export const maxBookSearchDepth = 'maxBookSearchDepth';
|
||||||
export const remoteBookDownloadTimeout = 'remoteBookDownloadTimeout';
|
export const remoteBookDownloadTimeout = 'remoteBookDownloadTimeout';
|
||||||
|
export const collapseBookItems = 'collapseBookItems';
|
||||||
|
|
||||||
export const winPlatform = 'win32';
|
export const winPlatform = 'win32';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user