Use nameSpan for getting basic symbol range

#51176
This commit is contained in:
Matt Bierner
2018-06-13 18:00:34 -07:00
parent 3cdda11bc9
commit 06ea138fbb

View File

@@ -109,16 +109,17 @@ export abstract class TypeScriptBaseCodeLensProvider implements CodeLensProvider
(item.childItems || []).forEach(child => this.walkNavTree(document, child, item, results));
}
/**
* TODO: TS currently requires the position for 'references 'to be inside of the identifer
* Massage the range to make sure this is the case
*/
protected getSymbolRange(document: TextDocument, item: Proto.NavigationTree): Range | null {
if (!item) {
return null;
}
// TS 3.0+ provides a span for just the symbol
if ((item as any).nameSpan) {
return typeConverters.Range.fromTextSpan((item as any).nameSpan);
}
// In older versions, we have to calculate this manually. See #23924
const span = item.spans && item.spans[0];
if (!span) {
return null;