mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
Extract getCodeLensLabel
This commit is contained in:
@@ -38,15 +38,19 @@ class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvide
|
|||||||
location.range.start.isEqual(codeLens.range.start)));
|
location.range.start.isEqual(codeLens.range.start)));
|
||||||
|
|
||||||
codeLens.command = {
|
codeLens.command = {
|
||||||
title: locations.length === 1
|
title: this.getCodeLensLabel(locations),
|
||||||
? localize('oneReferenceLabel', '1 reference')
|
|
||||||
: localize('manyReferenceLabel', '{0} references', locations.length),
|
|
||||||
command: locations.length ? 'editor.action.showReferences' : '',
|
command: locations.length ? 'editor.action.showReferences' : '',
|
||||||
arguments: [codeLens.document, codeLens.range.start, locations]
|
arguments: [codeLens.document, codeLens.range.start, locations]
|
||||||
};
|
};
|
||||||
return codeLens;
|
return codeLens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getCodeLensLabel(locations: ReadonlyArray<vscode.Location>): string {
|
||||||
|
return locations.length === 1
|
||||||
|
? localize('oneReferenceLabel', '1 reference')
|
||||||
|
: localize('manyReferenceLabel', '{0} references', locations.length);
|
||||||
|
}
|
||||||
|
|
||||||
protected extractSymbol(
|
protected extractSymbol(
|
||||||
document: vscode.TextDocument,
|
document: vscode.TextDocument,
|
||||||
item: Proto.NavigationTree,
|
item: Proto.NavigationTree,
|
||||||
|
|||||||
Reference in New Issue
Block a user