How to use the @theia/languages/lib/browser/typehierarchy/typehierarchy-protocol.TypeHierarchyDirection.Children function in @theia/languages

To help you get started, we’ve selected a few @theia/languages examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / typehierarchy / src / browser / tree / typehierarchy-tree.ts View on Github external
export function create(item: TypeHierarchyItem, direction: TypeHierarchyDirection, resolved: boolean = true): Node {
            const items = TypeHierarchyDirection.Children === direction ? item.children : item.parents;
            if (items && items.length > 0) {
                // If the server sent more levels than requested, use them.
                resolved = true;
            }
            const node = {
                id: v4(),
                name: item.name,
                description: item.detail,
                parent: undefined,
                location: Location.create(item.uri, item.selectionRange),
                resolved,
                children: items ? items.map(child => create(child, direction, false)) : [],
                expanded: false,
                visible: true,
                selected: false,
                kind: item.kind,
github eclipse-theia / theia / packages / typehierarchy / src / browser / typehierarchy-contribution.ts View on Github external
            execute: () => this.openViewOrFlipHierarchyDirection(TypeHierarchyDirection.Children),
            isEnabled: this.isEnabled.bind(this)
github eclipse-theia / theia / packages / typehierarchy / src / browser / typehierarchy-contribution.ts View on Github external
protected getDirection(args?: Partial): TypeHierarchyDirection {
        return !!args && !!args.direction ? args.direction : TypeHierarchyDirection.Children;
    }
github eclipse-theia / theia / packages / typehierarchy / src / browser / tree / typehierarchy-tree.ts View on Github external
protected async ensureResolved(node: TypeHierarchyTree.Node): Promise {
        if (!node.resolved) {
            const { service, direction } = this;
            if (service && direction !== undefined) {
                const { item } = node;
                const param: ResolveTypeHierarchyItemParams = {
                    item,
                    direction,
                    resolve: 1
                };
                const resolvedItem = await service.resolve(param);
                if (resolvedItem) {
                    node.resolved = true;
                    const items = TypeHierarchyDirection.Children === direction ? resolvedItem.children : resolvedItem.parents;
                    if (items) {
                        node.children = items.map(child => TypeHierarchyTree.Node.create(child, direction, false));
                    } else {
                        node.children = [];
                    }
                }
            }
        }
    }
github eclipse-theia / theia / packages / typehierarchy / src / browser / tree / typehierarchy-tree.ts View on Github external
data: new URI(item.uri).displayName,
                fontData: {
                    color: 'var(--theia-descriptionForeground)',
                }
            }];
            if (item.detail) {
                captionSuffixes.unshift({
                    data: item.detail,
                    fontData: {
                        color: 'var(--theia-list-highlightForeground)',
                        style: 'italic'
                    }
                });
            }
            const data = `${TypeHierarchyDirection.Children === direction ? '▼' : '▲'}`;
            const color = `var(${TypeHierarchyDirection.Children === direction ? '--theia-errorForeground' : '--theia-successBackground'})`;
            return {
                captionSuffixes,
                captionPrefixes: [{
                    data,
                    fontData: {
                        color,
                        style: 'bold'
                    }
                }]
            };
        }