diff --git a/src/vs/editor/contrib/codelens/codelens.ts b/src/vs/editor/contrib/codelens/codelens.ts index 3f80ac5442abf..92821ec5ee6a3 100644 --- a/src/vs/editor/contrib/codelens/codelens.ts +++ b/src/vs/editor/contrib/codelens/codelens.ts @@ -75,7 +75,7 @@ registerLanguageCommand('_executeCodeLensProvider', function (accessor, args) { let resolve: Thenable[] = []; 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))); diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index b9a820e8e5bed..4801ffcda5302 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -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) { @@ -558,7 +558,7 @@ suite('ExtHostLanguageFeatureCommands', function () { let value = await commands.executeCommand('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;