vscode#TreeItemCollapsibleState TypeScript Examples
The following examples show how to use
vscode#TreeItemCollapsibleState.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FolderOrNote.ts From joplin-utils with MIT License | 6 votes |
constructor(public item: JoplinListFolder | JoplinListNote) {
super(
item.title,
item.type_ === TypeEnum.Folder
? vscode.TreeItemCollapsibleState.Collapsed
: TreeItemCollapsibleState.None,
)
const iconName = FolderOrNote.getIconName(item)
this.iconPath = {
light: path.resolve(__dirname, `../resources/light/${iconName}.svg`),
dark: path.resolve(__dirname, `../resources/dark/${iconName}.svg`),
}
if (item.type_ === TypeEnum.Note) {
this.command = {
command: 'joplinNote.openNote',
title: this.item.title,
arguments: [this],
}
}
}
Example #2
Source File: EngineNoteProvider.ts From dendron with GNU Affero General Public License v3.0 | 6 votes |
public getExpandableTreeItems(): TreeItem[] {
const candidateItems = _.toArray(
_.pickBy(this._tree, (item) => {
const isCollapsed =
item.collapsibleState === TreeItemCollapsibleState.Collapsed;
const isShallow = DNodeUtils.getDepth(item.note) < 3;
return isCollapsed && isShallow;
})
);
return _.sortBy(candidateItems, (item) => {
return DNodeUtils.getDepth(item.note);
});
}
Example #3
Source File: history.ts From vscode-q with MIT License | 6 votes |
private constructor(history: History, parent: TreeItem | null) {
super(history.uniqLabel.replace(',', '-') + ' | ' + dayjs(history.time).format('HH:mm:ss'), TreeItemCollapsibleState.None);
this.uniqLabel = history.uniqLabel;
this.query = history.query;
this.time = history.time;
this.duration = history.duration;
this._parent = parent;
this.errorMsg = history.errorMsg;
const mdString = new MarkdownString();
mdString.appendMarkdown(`- server: ${history.uniqLabel.replace(',', '-')}\n`);
mdString.appendMarkdown(`- time: ${dayjs(history.time).format('YYYY.MM.DD HH:mm:ss.SSS')}\n`);
mdString.appendMarkdown(`- duration: ${history.duration}\n`);
if (this.errorMsg) {
mdString.appendMarkdown('- error:');
mdString.appendCodeblock(this.errorMsg, 'q');
} else {
mdString.appendMarkdown('- query:');
mdString.appendCodeblock(history.query, 'q');
}
this.tooltip = mdString;
}
Example #4
Source File: parentNode.ts From vscode-ssh with MIT License | 6 votes |
constructor(readonly sshConfig: SSHConfig, readonly name: string, readonly file?: FileEntry, readonly parentName?: string, iconPath?: string) {
super(name, TreeItemCollapsibleState.Collapsed);
this.id = file ? `${sshConfig.username}@${sshConfig.host}_${sshConfig.port}_${parentName}.${name}` : `${sshConfig.username}@${sshConfig.host}:${sshConfig.port}`;
this.fullPath = this.parentName + this.name;
if (!file) {
this.contextValue = NodeType.CONNECTION;
this.iconPath = path.join(ServiceManager.context.extensionPath, 'resources', 'image', `chain.svg`);
} else {
this.contextValue = NodeType.FOLDER;
this.iconPath = path.join(ServiceManager.context.extensionPath, 'resources', 'image', `folder.svg`);
}
if (file && file.filename.toLocaleLowerCase() == "home") {
this.iconPath = `${ServiceManager.context.extensionPath}/resources/image/folder-core.svg`;
} else if (iconPath) {
this.iconPath = iconPath;
}
}
Example #5
Source File: stripeTreeItem.ts From vscode-stripe with MIT License | 6 votes |
addChild(item: StripeTreeItem) {
this.children.push(item);
if (this.children.length) {
if (this.collapsibleState !== TreeItemCollapsibleState.Expanded) {
this.makeCollapsible();
}
}
return this;
}
Example #6
Source File: taskProvider.ts From vscode-todo-md with MIT License | 6 votes |
constructor(
readonly label: string,
readonly task: TheTask,
readonly command: Command,
) {
super(label);
if (task.links.length) {
this.contextValue = 'link';
}
if (task.subtasks.length) {
if (task.isCollapsed) {
this.collapsibleState = TreeItemCollapsibleState.Collapsed;
} else {
this.collapsibleState = TreeItemCollapsibleState.Expanded;
}
}
if (task.done) {
this.iconPath = new ThemeIcon('pass', new ThemeColor('todomd.treeViewCompletedTaskIcon'));
} else {
// this.iconPath = new ThemeIcon('circle-large-outline');// TODO: maybe
}
}
Example #7
Source File: RootNode.ts From al-objid with MIT License | 6 votes |
constructor(app: ALApp, view: ViewController) {
super(undefined);
this._app = app;
this._view = view;
this._label = app.name || app.manifest.name;
this._description = app.manifest.version;
this._tooltip = `${app.manifest.name} v${app.manifest.version}`;
this._uriAuthority = app.hash;
this._collapsibleState = TreeItemCollapsibleState.Expanded;
this._contextValues.push(ContextValues.Sync);
}
Example #8
Source File: Backlink.ts From dendron with GNU Affero General Public License v3.0 | 6 votes |
private constructor(
label: string,
refs: FoundRefT[] | undefined,
collapsibleState: vscode.TreeItemCollapsibleState,
public readonly treeItemType: BacklinkTreeItemType,
singleRef: FoundRefT | undefined
) {
super(label, collapsibleState);
if (refs) {
this.refs = refs.map((r) => ({ ...r, parentBacklink: this }));
} else {
this.refs = undefined;
}
if (singleRef) {
this.singleRef = singleRef;
}
}
Example #9
Source File: RangeNode.ts From al-objid with MIT License | 6 votes |
protected calculateChildren(): Node[] {
const children: Node[] = [];
for (let key of Object.values<string>(ALObjectType)) {
const type = key as ALObjectType;
if (this._consumption[type] === undefined || this._consumption[type].length === 0) {
continue;
}
const ids = this._consumption[type].filter(id => id >= this.range.from && id <= this.range.to);
if (ids.length === 0) {
continue;
}
children.push(new ObjectTypeConsumptionNode(this, key, ids, this.size));
}
if (children.length === 0) {
this._noConsumption = true;
this._collapsibleState = TreeItemCollapsibleState.None;
this._decoration = {
badge: "-",
severity: DecorationSeverity.inactive,
tooltip: `No consumption has been recorded`,
};
this._iconPath = NinjaIcon["arrow-both-inactive"];
} else {
this._decoration = undefined;
}
return children;
}
Example #10
Source File: tree-data-provider.ts From plugin-vscode with Apache License 2.0 | 6 votes |
private createPackageData(packages: Package[]): PackageTreeItem[] {
let packageItems: PackageTreeItem[] = [];
packages.sort((package1, package2) => {
return package1.name.localeCompare(package2.name!);
});
packages.forEach(projectPackage => {
projectPackage.name = projectPackage.name === '.' ? window.activeTextEditor!.document.fileName
.replace('.bal', '').split(sep).pop()!.toString() : projectPackage.name;
if (projectPackage.name) {
packageItems.push(new PackageTreeItem(projectPackage.name, '',
TreeItemCollapsibleState.Expanded, PROJECT_KIND.PACKAGE, fileUriToPath(projectPackage.filePath),
this.extensionPath, true, null, { modules: projectPackage.modules }));
}
});
return packageItems;
}
Example #11
Source File: fileNode.ts From vscode-ssh with MIT License | 6 votes |
constructor(readonly sshConfig: SSHConfig, readonly file: FileEntry, readonly parentName: string) {
super(file.filename, TreeItemCollapsibleState.None)
this.description = prettyBytes(file.attrs.size)
this.iconPath = this.getIcon(this.file.filename)
this.fullPath = this.parentName + this.file.filename;
this.command = {
command: "ssh.file.open",
arguments: [this],
title: "Open File"
}
}
Example #12
Source File: tree-data-provider.ts From plugin-vscode with Apache License 2.0 | 6 votes |
/**
* Returns the tree structure for resources.
* @returns An array of tree nodes with resource data.
*/
private getResourceStructure(parent: PackageTreeItem): PackageTreeItem[] {
let resources: PackageTreeItem[] = [];
const children: ChildrenData = parent.getChildrenData();
if (children.resources) {
const resourceNodes = children.resources;
resourceNodes.sort((resource1, resource2) => {
return resource1.name!.localeCompare(resource2.name!);
});
resourceNodes.forEach(resource => {
resources.push(new PackageTreeItem(resource.name, '',
TreeItemCollapsibleState.None, PROJECT_KIND.RESOURCE, parent.getFilePath(), this.extensionPath, true,
parent, {}, resource.startLine, resource.startColumn, resource.endLine, resource.endColumn));
});
}
return resources;
}
Example #13
Source File: comment-list-entry.ts From vscode-code-review with MIT License | 6 votes |
constructor(
public readonly id: string,
public readonly label: string,
public readonly text: string,
public readonly hoverLabel: string,
public readonly collapsibleState: TreeItemCollapsibleState,
public readonly data: ReviewFileExportSection,
public readonly prio?: number,
public readonly priv?: number,
) {
super(label, collapsibleState);
}
Example #14
Source File: Backlink.ts From dendron with GNU Affero General Public License v3.0 | 6 votes |
public static createRefLevelBacklink(reference: FoundRefT): Backlink {
return new Backlink(
reference.matchText,
undefined,
TreeItemCollapsibleState.None,
BacklinkTreeItemType.referenceLevel,
reference
);
}
Example #15
Source File: infoNode.ts From vscode-ssh with MIT License | 5 votes |
constructor(info: string) {
super(info)
this.collapsibleState = TreeItemCollapsibleState.None
}
Example #16
Source File: Node.ts From al-objid with MIT License | 5 votes |
protected abstract _collapsibleState: TreeItemCollapsibleState;
Example #17
Source File: infoNode.ts From vscode-ssh with MIT License | 5 votes |
constructor(info: string) {
super(info)
this.iconPath={
light: Util.getExtPath("resources", "image", "light", "link.svg"),
dark: Util.getExtPath("resources", "image","dark", "link.svg"),
}
this.collapsibleState = TreeItemCollapsibleState.None
}
Example #18
Source File: stripeTreeItem.ts From vscode-stripe with MIT License | 5 votes |
expand() {
this.collapsibleState = TreeItemCollapsibleState.Expanded;
}
Example #19
Source File: RootNode.ts From al-objid with MIT License | 5 votes |
protected readonly _collapsibleState: TreeItemCollapsibleState;
Example #20
Source File: ModelTreeviewProvider.ts From vscode-dbt-power-user with MIT License | 5 votes |
collapsibleState = TreeItemCollapsibleState.None;
Example #21
Source File: local.ts From cloudmusic-vscode with MIT License | 5 votes |
constructor(label: string) {
super(label, TreeItemCollapsibleState.Collapsed);
}
Example #22
Source File: tree-data-provider.ts From plugin-vscode with Apache License 2.0 | 5 votes |
/**
* Returns the tree structure for functions and services.
* @returns An array of tree nodes with module component data.
*/
private getComponentStructure(parent: PackageTreeItem, isDefaultModule: boolean = false,
childrenData: ChildrenData = {}): PackageTreeItem[] {
let components: PackageTreeItem[] = [];
const children: ChildrenData = isDefaultModule ? childrenData : parent.getChildrenData();
//Process function nodes
if (children.functions) {
const functionNodes = children.functions;
functionNodes.sort((fn1, fn2) => {
return fn1.name!.localeCompare(fn2.name!);
});
functionNodes.forEach(fn => {
components.push(new PackageTreeItem(fn.name, `${fn.filePath}`, TreeItemCollapsibleState.None,
PROJECT_KIND.FUNCTION, join(parent.getFilePath(), fn.filePath), this.extensionPath, true, parent,
{}, fn.startLine, fn.startColumn, fn.endLine, fn.endColumn));
});
}
//Process service nodes
if (children.services) {
const serviceNodes = children.services.filter(service => {
return service.name;
});
serviceNodes.sort((service1, service2) => {
return service1.name!.localeCompare(service2.name!);
});
serviceNodes.forEach(service => {
components.push(new PackageTreeItem(service.name, `${service.filePath}`,
TreeItemCollapsibleState.Collapsed, PROJECT_KIND.SERVICE, join(parent.getFilePath(),
service.filePath), this.extensionPath, true, parent, { resources: service.resources },
service.startLine, service.startColumn, service.endLine, service.endColumn));
});
const serviceNodesWithoutName = children.services.filter(service => {
return !service.name;
});
let count: number = 0;
serviceNodesWithoutName.forEach(service => {
components.push(new PackageTreeItem(`${PROJECT_KIND.SERVICE} ${++count}`, `${service.filePath}`,
TreeItemCollapsibleState.Collapsed, PROJECT_KIND.SERVICE, join(parent.getFilePath(),
service.filePath), this.extensionPath, true, parent, { resources: service.resources },
service.startLine, service.startColumn, service.endLine, service.endColumn));
});
}
return components;
}
Example #23
Source File: export-factory.ts From vscode-code-review with MIT License | 5 votes |
public getFilesContainingComments(): Thenable<CommentListEntry[]> {
if (!fs.existsSync(this.absoluteFilePath) || !this.generator.check()) {
return Promise.resolve([]);
}
const entries: CsvEntry[] = [];
return new Promise((resolve) => {
parseFile(this.absoluteFilePath, { delimiter: ',', ignoreEmpty: true, headers: true })
.on('error', () => this.handleError)
.on('data', (row: CsvEntry) => {
if (this.isCommentEligible(row)) {
entries.push(row);
}
})
.on('end', () => {
const sortedByFile = this.groupResults(entries, Group.filename);
const listEntries = sortedByFile.map((el: ReviewFileExportSection, index: number) => {
const item = new CommentListEntry(
'',
el.group,
`(${el.lines.length})`,
`${el.lines.length} comments`,
// Expand the first (and only) file when in filtered by filename mode
this.filterByFilename && index === 0
? TreeItemCollapsibleState.Expanded
: TreeItemCollapsibleState.Collapsed,
el,
);
item.command = {
command: 'codeReview.openSelection',
title: 'reveal comment',
arguments: [el],
};
item.contextValue = 'file';
item.iconPath = {
light: this.context.asAbsolutePath(path.join('dist', 'document-light.svg')),
dark: this.context.asAbsolutePath(path.join('dist', 'document-dark.svg')),
};
return item;
});
resolve(listEntries);
});
});
}
Example #24
Source File: ModelTreeviewProvider.ts From vscode-dbt-power-user with MIT License | 5 votes |
collapsibleState = TreeItemCollapsibleState.Collapsed;
Example #25
Source File: ExpandCollapseController.ts From al-objid with MIT License | 5 votes |
private _treeState: WeakMap<Node, TreeItemCollapsibleState | undefined> = new WeakMap();
Example #26
Source File: q-server-tree.ts From vscode-q with MIT License | 5 votes |
constructor(label: string, parent: TreeItem | null) {
super(label, TreeItemCollapsibleState.Collapsed);
this._parent = parent;
}
Example #27
Source File: stripeTreeItem.ts From vscode-stripe with MIT License | 5 votes |
makeCollapsible() {
this.collapsibleState = TreeItemCollapsibleState.Collapsed;
}
Example #28
Source File: driveTreeDataProvider.ts From google-drive-vscode with MIT License | 5 votes |
private detectCollapsibleState(currentFile: DriveFile): TreeItemCollapsibleState {
const collapsible = currentFile.type == FileType.DIRECTORY ?
TreeItemCollapsibleState.Collapsed :
TreeItemCollapsibleState.None;
return collapsible;
}
Example #29
Source File: contextProvider.ts From vscode-todo-md with MIT License | 5 votes |
readonly collapsibleState = TreeItemCollapsibleState.Collapsed;