Allow Code Lenses to Provide only a Title

Fixes #24209

**Bug**
Currently, for the js/ts references code lens, even if there are zero references you can click on the lens. This display an empty peek view

**Fix**
Allow code lenses to only register a title for the lens with no actual backing command
This commit is contained in:
Matt Bierner
2017-04-10 14:56:37 -07:00
parent 8d3f2bf45b
commit a0cb432471
3 changed files with 3 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ export default class TypeScriptImplementationsCodeLensProvider extends TypeScrip
title: locations.length === 1
? localize('oneImplementationLabel', '1 implementation')
: localize('manyImplementationLabel', '{0} implementations', locations.length),
command: 'editor.action.showReferences',
command: locations.length ? 'editor.action.showReferences' : '',
arguments: [codeLens.document, codeLens.range.start, locations]
};
return codeLens;

View File

@@ -56,7 +56,7 @@ export default class TypeScriptReferencesCodeLensProvider extends TypeScriptBase
title: locations.length === 1
? localize('oneReferenceLabel', '1 reference')
: localize('manyReferenceLabel', '{0} references', locations.length),
command: 'editor.action.showReferences',
command: locations.length ? 'editor.action.showReferences' : '',
arguments: [codeLens.document, codeLens.range.start, locations]
};
return codeLens;