提交 8327d3fa 编写于 作者: M Matt Bierner

Don't drop current code lens promise if the current resolve promise has changed

Fixes #84185
上级 696465bd
...@@ -326,7 +326,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { ...@@ -326,7 +326,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
return; return;
} }
this._currentResolveCodeLensSymbolsPromise = createCancelablePromise(token => { const resolvePromise = createCancelablePromise(token => {
const promises = toResolve.map((request, i) => { const promises = toResolve.map((request, i) => {
...@@ -351,16 +351,21 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { ...@@ -351,16 +351,21 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
return Promise.all(promises); return Promise.all(promises);
}); });
this._currentResolveCodeLensSymbolsPromise = resolvePromise;
this._currentResolveCodeLensSymbolsPromise.then(() => { this._currentResolveCodeLensSymbolsPromise.then(() => {
if (this._currentCodeLensModel) { // update the cached state with new resolved items if (this._currentCodeLensModel) { // update the cached state with new resolved items
this._codeLensCache.put(model, this._currentCodeLensModel); this._codeLensCache.put(model, this._currentCodeLensModel);
} }
this._oldCodeLensModels.clear(); // dispose old models once we have updated the UI with the current model this._oldCodeLensModels.clear(); // dispose old models once we have updated the UI with the current model
this._currentResolveCodeLensSymbolsPromise = undefined; if (resolvePromise === this._currentResolveCodeLensSymbolsPromise) {
this._currentResolveCodeLensSymbolsPromise = undefined;
}
}, err => { }, err => {
onUnexpectedError(err); // can also be cancellation! onUnexpectedError(err); // can also be cancellation!
this._currentResolveCodeLensSymbolsPromise = undefined; if (resolvePromise === this._currentResolveCodeLensSymbolsPromise) {
this._currentResolveCodeLensSymbolsPromise = undefined;
}
}); });
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册