Skip to content

Commit

Permalink
Merge pull request mtxr#111 from PapsOu/master
Browse files Browse the repository at this point in the history
Add option to disable or enable table columns collapse on first load
  • Loading branch information
mtxr authored Nov 15, 2018
2 parents 4a069ad + 97565e0 commit f238d25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@
"type": "number",
"description": "Global show records limit",
"default": 10
},
"sqltools.tableTreeItemsExpanded": {
"type": "boolean",
"default": true,
"description": "Table columns should be expanded on load ?"
}
}
},
Expand Down
5 changes: 4 additions & 1 deletion src/providers/sidebar-provider/sidebar-tree-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
window,
} from 'vscode';
import DatabaseInterface from './../../api/interface/database-interface';
import ConfigManager from './../../api/config-manager';

export class SidebarDatabase extends TreeItem {
public iconPath = {
Expand All @@ -32,6 +33,8 @@ export class SidebarDatabase extends TreeItem {
}
}

const tableTreeItemsExpanded = ConfigManager.get('tableTreeItemsExpanded', true);

export class SidebarDatabaseStructure extends TreeItem {
public iconPath = {
dark: path.join(__dirname, '..', '..', 'resources', 'icon', 'folder-open-dark.svg'),
Expand Down Expand Up @@ -64,7 +67,7 @@ export class SidebarTable extends TreeItem {

public items: SidebarColumn[] = [];
constructor(table: DatabaseInterface.Table) {
super(table.name, TreeItemCollapsibleState.Expanded);
super(table.name, tableTreeItemsExpanded === true ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed);
this.value = table.name;
this.label = `${table.name} (${table.numberOfColumns} cols)`;
}
Expand Down

0 comments on commit f238d25

Please sign in to comment.