gracefully handle the case in which a delegate command has been disposed before execution, fixes #3265

This commit is contained in:
Johannes Rieken
2016-04-21 13:55:05 +02:00
parent 255c7d5a96
commit 56b71bd9c1
5 changed files with 51 additions and 27 deletions

View File

@@ -87,7 +87,7 @@ class CodeLensAdapter implements modes.ICodeLensSupport {
data.symbols.push(<modes.ICodeLensSymbol>{
id: String(i),
range: TypeConverters.fromRange(lens.range),
command: TypeConverters.Command.from(lens.command, { commands: this._commands, disposables: data.disposables })
command: TypeConverters.Command.from(lens.command, data.disposables)
});
});
@@ -144,7 +144,7 @@ class CodeLensAdapter implements modes.ICodeLensSupport {
};
}
symbol.command = TypeConverters.Command.from(command, { commands: this._commands, disposables: cachedData.disposables });
symbol.command = TypeConverters.Command.from(command, cachedData.disposables);
return symbol;
});
});
@@ -315,7 +315,6 @@ class QuickFixAdapter implements modes.IQuickFixSupport {
});
this._cachedCommands = dispose(this._cachedCommands);
const ctx = { commands: this._commands, disposables: this._cachedCommands };
return asWinJsPromise(token => this._provider.provideCodeActions(doc, ran, { diagnostics: allDiagnostics }, token)).then(commands => {
if (!Array.isArray(commands)) {
@@ -323,7 +322,7 @@ class QuickFixAdapter implements modes.IQuickFixSupport {
}
return commands.map((command, i) => {
return <modes.IQuickFix> {
command: TypeConverters.Command.from(command, ctx),
command: TypeConverters.Command.from(command, this._cachedCommands),
score: i
};
});