How to use the @theia/callhierarchy/lib/browser/utils.isSame function in @theia/callhierarchy

To help you get started, we’ve selected a few @theia/callhierarchy 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 / typescript / src / browser / typescript-callhierarchy-service.ts View on Github external
let bestMatch: SymbolInformation | undefined = undefined;
        let bestRange: Range | undefined = undefined;
        for (const candidate of symbols) {
            const candidateRange = candidate.location.range;
            if (utils.containsRange(candidateRange, reference.range)) {
                // as opposed to default, find the topmost (earliest) symbol
                if (!bestMatch || utils.startsAfter(bestRange!, candidateRange)) {
                    bestMatch = candidate;
                    bestRange = candidateRange;
                }
            }
        }
        if (bestMatch) {
            // filter references that are in fact definitions
            const nameLocation = await this.getSymbolNameLocation(bestMatch, context);
            if (!nameLocation || utils.isSame(nameLocation, reference)) {
                return undefined;
            }
        }
        return bestMatch;
    }
}

@theia/callhierarchy

Theia - Call Hierarchy Extension

EPL-2.0
Latest version published 3 days ago

Package Health Score

87 / 100
Full package analysis