mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 10:00:13 -06:00
Harden combineProjectOutputForReferences against empty results (#48978)
Getting an empty result doesn't seem expected, but a deeper fix doesn't make sense until #48619 is merged. Fixes #48963
This commit is contained in:
parent
4680b54616
commit
58114cf387
@ -356,7 +356,7 @@ namespace ts.server {
|
||||
logger.info(`Finding references to ${location.fileName} position ${location.pos} in project ${project.getProjectName()}`);
|
||||
const projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
||||
if (projectOutputs) {
|
||||
const clearIsDefinition = projectOutputs[0].references[0].isDefinition === undefined;
|
||||
const clearIsDefinition = projectOutputs[0]?.references[0]?.isDefinition === undefined;
|
||||
for (const referencedSymbol of projectOutputs) {
|
||||
const mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(referencedSymbol.definition));
|
||||
const definition: ReferencedSymbolDefinitionInfo = mappedDefinitionFile === undefined ?
|
||||
|
||||
@ -0,0 +1 @@
|
||||
[]
|
||||
@ -0,0 +1,5 @@
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////const str: string = "hello/*1*/";
|
||||
|
||||
verify.baselineFindAllReferences('1')
|
||||
Loading…
x
Reference in New Issue
Block a user