Skip to content

Commit

Permalink
Allow Code Lenses to Provide only a Title
Browse files Browse the repository at this point in the history
Fixes microsoft#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
  • Loading branch information
mjbvz committed Apr 12, 2017
1 parent 8d3f2bf commit a0cb432
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/node/extHostCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class CommandsConverter {
title: command.title
};

if (!isFalsyOrEmpty(command.arguments)) {
if (command.command && !isFalsyOrEmpty(command.arguments)) {
// we have a contributed command with arguments. that
// means we don't want to send the arguments around

Expand Down

0 comments on commit a0cb432

Please sign in to comment.