Skip to content

Commit

Permalink
don't count already resolved items, #44846
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Apr 19, 2018
1 parent 2ad75aa commit 6c3cb56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/codelens/codelens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ registerLanguageCommand('_executeCodeLensProvider', function (accessor, args) {
let resolve: Thenable<any>[] = [];

for (const item of value) {
if (typeof itemResolveCount === 'undefined') {
if (typeof itemResolveCount === 'undefined' || Boolean(item.symbol.command)) {
result.push(item.symbol);
} else if (itemResolveCount-- > 0) {
resolve.push(Promise.resolve(item.provider.resolveCodeLens(model, item.symbol, CancellationToken.None)).then(symbol => result.push(symbol)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
new types.CodeLens(new types.Range(0, 0, 1, 1)),
new types.CodeLens(new types.Range(0, 0, 1, 1)),
new types.CodeLens(new types.Range(0, 0, 1, 1)),
new types.CodeLens(new types.Range(0, 0, 1, 1))
new types.CodeLens(new types.Range(0, 0, 1, 1), { title: 'Already resolved', command: 'fff' })
];
},
resolveCodeLens(codeLens: types.CodeLens) {
Expand All @@ -558,7 +558,7 @@ suite('ExtHostLanguageFeatureCommands', function () {

let value = await commands.executeCommand<vscode.CodeLens[]>('vscode.executeCodeLensProvider', model.uri, 2);

assert.equal(value.length, 2); // the resolve argument defines the number of results being returned
assert.equal(value.length, 3); // the resolve argument defines the number of results being returned
assert.equal(resolveCount, 2);

resolveCount = 0;
Expand Down

0 comments on commit 6c3cb56

Please sign in to comment.