mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 16:49:06 +01:00
Partial fix for ExtHost CodeLenses registering commands after they have already been disposed of
For #75105 This change ensures that we do not try registering a command while resolving a code lens. However it does not fix the issue where we can end up trying to invoke a command that has already been disposed of
This commit is contained in:
@@ -145,8 +145,7 @@ class CodeLensAdapter {
|
||||
resolveCodeLens(symbol: CodeLensDto, token: CancellationToken): Promise<CodeLensDto | undefined> {
|
||||
|
||||
const lens = symbol.cacheId && this._cache.get(...symbol.cacheId);
|
||||
const disposables = symbol.cacheId && this._disposables.get(symbol.cacheId[0]);
|
||||
if (!lens || !disposables) {
|
||||
if (!lens) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -158,6 +157,16 @@ class CodeLensAdapter {
|
||||
}
|
||||
|
||||
return resolve.then(newLens => {
|
||||
if (token.isCancellationRequested) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const disposables = symbol.cacheId && this._disposables.get(symbol.cacheId[0]);
|
||||
if (!disposables) {
|
||||
// We've already been disposed of
|
||||
return undefined;
|
||||
}
|
||||
|
||||
newLens = newLens || lens;
|
||||
symbol.command = this._commands.toInternal2(newLens.command || CodeLensAdapter._badCmd, disposables);
|
||||
return symbol;
|
||||
|
||||
Reference in New Issue
Block a user