use Dto<T> util in more places, some clean-up/alignment of caching logic

This commit is contained in:
Johannes Rieken
2022-01-19 15:12:08 +01:00
parent dcc6643fd7
commit 15db136c3c
5 changed files with 60 additions and 118 deletions

View File

@@ -8,7 +8,7 @@ import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
import * as extHostTypeConverter from 'vs/workbench/api/common/extHostTypeConverters';
import { cloneAndChange } from 'vs/base/common/objects';
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ObjectIdentifier, ICommandDto, ICommandHandlerDescriptionDto } from './extHost.protocol';
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ICommandDto, ICommandHandlerDescriptionDto } from './extHost.protocol';
import { isNonEmptyArray } from 'vs/base/common/arrays';
import * as modes from 'vs/editor/common/languages';
import type * as vscode from 'vscode';
@@ -355,11 +355,10 @@ export class CommandsConverter {
return result;
}
fromInternal(command: modes.Command): vscode.Command | undefined {
fromInternal(command: ICommandDto): vscode.Command | undefined {
const id = ObjectIdentifier.of(command);
if (typeof id === 'number') {
return this._cache.get(id);
if (typeof command.$ident === 'number') {
return this._cache.get(command.$ident);
} else {
return {