Path: blob/main/src/vs/base/common/hierarchicalKind.ts
3291 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45export class HierarchicalKind {6public static readonly sep = '.';78public static readonly None = new HierarchicalKind('@@none@@'); // Special kind that matches nothing9public static readonly Empty = new HierarchicalKind('');1011constructor(12public readonly value: string13) { }1415public equals(other: HierarchicalKind): boolean {16return this.value === other.value;17}1819public contains(other: HierarchicalKind): boolean {20return this.equals(other) || this.value === '' || other.value.startsWith(this.value + HierarchicalKind.sep);21}2223public intersects(other: HierarchicalKind): boolean {24return this.contains(other) || other.contains(this);25}2627public append(...parts: string[]): HierarchicalKind {28return new HierarchicalKind((this.value ? [this.value, ...parts] : parts).join(HierarchicalKind.sep));29}30}313233