Skip to content

Commit

Permalink
only resolve lenses that aren't resolved yet, microsoft#68290
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Feb 12, 2019
1 parent a066fd1 commit af24788
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/vs/editor/contrib/codelens/codelensController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,14 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {

const resolvedSymbols = new Array<ICodeLensSymbol | undefined | null>(request.length);
const promises = request.map((request, i) => {
if (typeof request.provider.resolveCodeLens === 'function') {
if (!request.symbol.command && typeof request.provider.resolveCodeLens === 'function') {
return Promise.resolve(request.provider.resolveCodeLens(model, request.symbol, token)).then(symbol => {
resolvedSymbols[i] = symbol;
});
} else {
resolvedSymbols[i] = request.symbol;
return Promise.resolve(undefined);
}
resolvedSymbols[i] = request.symbol;
return Promise.resolve(undefined);
});

return Promise.all(promises).then(() => {
Expand Down
7 changes: 7 additions & 0 deletions src/vs/editor/contrib/codelens/codelensWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ export class CodeLens {

updateCommands(symbols: Array<ICodeLensSymbol | undefined | null>): void {
this._contentWidget.withCommands(symbols);
for (let i = 0; i < this._data.length; i++) {
const resolved = symbols[i];
if (resolved) {
const { symbol } = this._data[i];
symbol.command = resolved.command || symbol.command;
}
}
}

updateHeight(): void {
Expand Down

0 comments on commit af24788

Please sign in to comment.