mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)
* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c * remove files we don't want * fix hygiene * update distro * update distro * fix hygiene * fix strict nulls * distro * distro * fix tests * fix tests * add another edit * fix viewlet icon * fix azure dialog * fix some padding * fix more padding issues
This commit is contained in:
@@ -47,7 +47,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
) {
|
||||
this._proxy = extHostRpc.getProxy(MainContext.MainThreadCommands);
|
||||
this._logService = logService;
|
||||
this._converter = new CommandsConverter(this);
|
||||
this._converter = new CommandsConverter(this, logService);
|
||||
this._argumentProcessors = [
|
||||
{
|
||||
processArgument(a) {
|
||||
@@ -218,14 +218,15 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
export class CommandsConverter {
|
||||
|
||||
private readonly _delegatingCommandId: string;
|
||||
private readonly _commands: ExtHostCommands;
|
||||
private readonly _cache = new Map<number, vscode.Command>();
|
||||
private _cachIdPool = 0;
|
||||
|
||||
// --- conversion between internal and api commands
|
||||
constructor(commands: ExtHostCommands) {
|
||||
constructor(
|
||||
private readonly _commands: ExtHostCommands,
|
||||
private readonly _logService: ILogService
|
||||
) {
|
||||
this._delegatingCommandId = `_vscode_delegate_cmd_${Date.now().toString(36)}`;
|
||||
this._commands = commands;
|
||||
this._commands.registerCommand(true, this._delegatingCommandId, this._executeConvertedCommand, this);
|
||||
}
|
||||
|
||||
@@ -248,12 +249,16 @@ export class CommandsConverter {
|
||||
|
||||
const id = ++this._cachIdPool;
|
||||
this._cache.set(id, command);
|
||||
disposables.add(toDisposable(() => this._cache.delete(id)));
|
||||
disposables.add(toDisposable(() => {
|
||||
this._cache.delete(id);
|
||||
this._logService.trace('CommandsConverter#DISPOSE', id);
|
||||
}));
|
||||
result.$ident = id;
|
||||
|
||||
result.id = this._delegatingCommandId;
|
||||
result.arguments = [id];
|
||||
|
||||
this._logService.trace('CommandsConverter#CREATE', command.command, id);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -276,6 +281,8 @@ export class CommandsConverter {
|
||||
|
||||
private _executeConvertedCommand<R>(...args: any[]): Promise<R> {
|
||||
const actualCmd = this._cache.get(args[0]);
|
||||
this._logService.trace('CommandsConverter#EXECUTE', args[0], actualCmd ? actualCmd.command : 'MISSING');
|
||||
|
||||
if (!actualCmd) {
|
||||
return Promise.reject('actual command NOT FOUND');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user