Skip to content

Commit

Permalink
ignore declaration when references return only two results, #83752
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 6, 2019
1 parent 22adcb9 commit 7b9217c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/vs/editor/contrib/gotoSymbol/goToSymbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ export function getTypeDefinitionsAtPosition(model: ITextModel, position: Positi
}

export function getReferencesAtPosition(model: ITextModel, position: Position, token: CancellationToken): Promise<LocationLink[]> {
return getLocationLinks(model, position, ReferenceProviderRegistry, (provider, model, position) => {
return provider.provideReferences(model, position, { includeDeclaration: true }, token);
return getLocationLinks(model, position, ReferenceProviderRegistry, async (provider, model, position) => {
const result = await provider.provideReferences(model, position, { includeDeclaration: true }, token);
if (!result || result.length !== 2) {
return result;
}
const resultWithoutDeclaration = await provider.provideReferences(model, position, { includeDeclaration: false }, token);
if (resultWithoutDeclaration && resultWithoutDeclaration.length === 1) {
return resultWithoutDeclaration;
}
return result;
});
}

Expand Down

0 comments on commit 7b9217c

Please sign in to comment.