Merge pull request #140927 from microsoft/joh/dtooooo

This commit is contained in:
Johannes Rieken
2022-01-19 13:59:23 +01:00
committed by GitHub
10 changed files with 59 additions and 39 deletions

View File

@@ -13,7 +13,6 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import { MarshalledId, revive } from 'vs/base/common/marshalling';
import * as performance from 'vs/base/common/performance';
import Severity from 'vs/base/common/severity';
import { Dto } from 'vs/base/common/types';
import { URI, UriComponents } from 'vs/base/common/uri';
import { RenderLineNumbersType, TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
import { IPosition } from 'vs/editor/common/core/position';
@@ -25,7 +24,6 @@ import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel';
import * as modes from 'vs/editor/common/languages';
import { CharacterPair, CommentRule, EnterAction } from 'vs/editor/common/languages/languageConfiguration';
import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility';
import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { ConfigurationTarget, IConfigurationChange, IConfigurationData, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration';
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
@@ -66,7 +64,7 @@ import { InternalTimelineOptions, Timeline, TimelineChangeEvent, TimelineOptions
import { TypeHierarchyItem } from 'vs/workbench/contrib/typeHierarchy/common/typeHierarchy';
import { EditorGroupColumn } from 'vs/workbench/services/editor/common/editorGroupColumn';
import { ActivationKind, ExtensionHostKind, MissingExtensionDependency } from 'vs/workbench/services/extensions/common/extensions';
import { createProxyIdentifier, IRPCProtocol, SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import { createProxyIdentifier, Dto, IRPCProtocol, SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import { ILanguageStatus } from 'vs/workbench/services/languageStatus/common/languageStatusService';
import { CandidatePort } from 'vs/workbench/services/remote/common/remoteExplorerService';
import * as search from 'vs/workbench/services/search/common/search';
@@ -1221,9 +1219,19 @@ export interface MainThreadTimelineShape extends IDisposable {
// -- extension host
export interface ICommandHandlerDescriptionDto {
readonly description: string;
readonly args: ReadonlyArray<{
readonly name: string;
readonly isOptional?: boolean;
readonly description?: string;
}>;
readonly returns?: string;
}
export interface ExtHostCommandsShape {
$executeContributedCommand(id: string, ...args: any[]): Promise<unknown>;
$getContributedCommandHandlerDescriptions(): Promise<{ [id: string]: string | ICommandHandlerDescription; }>;
$getContributedCommandHandlerDescriptions(): Promise<{ [id: string]: string | ICommandHandlerDescriptionDto; }>;
}
export interface ExtHostConfigurationShape {
@@ -1517,7 +1525,7 @@ export interface ISignatureHelpContextDto {
export interface IInlayHintDto {
cacheId?: ChainedCacheId;
label: string | modes.InlayHintLabelPart[];
label: string | Dto<modes.InlayHintLabelPart[]>;
tooltip?: string | IMarkdownString;
position: IPosition;
kind: modes.InlayHintKind;
@@ -1627,7 +1635,7 @@ export interface ICodeActionDto {
cacheId?: ChainedCacheId;
title: string;
edit?: IWorkspaceEditDto;
diagnostics?: IMarkerData[];
diagnostics?: Dto<IMarkerData[]>;
command?: ICommandDto;
kind?: string;
isPreferred?: boolean;
@@ -1825,14 +1833,14 @@ export interface ExtHostSCMShape {
}
export interface ExtHostTaskShape {
$provideTasks(handle: number, validTypes: { [key: string]: boolean; }): Thenable<tasks.TaskSetDTO>;
$resolveTask(handle: number, taskDTO: tasks.TaskDTO): Thenable<tasks.TaskDTO | undefined>;
$provideTasks(handle: number, validTypes: { [key: string]: boolean; }): Promise<tasks.TaskSetDTO>;
$resolveTask(handle: number, taskDTO: tasks.TaskDTO): Promise<tasks.TaskDTO | undefined>;
$onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): void;
$onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): void;
$onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): void;
$OnDidEndTask(execution: tasks.TaskExecutionDTO): void;
$resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string; }, variables: string[]; }): Promise<{ process?: string; variables: { [key: string]: string; }; }>;
$jsonTasksSupported(): Thenable<boolean>;
$jsonTasksSupported(): Promise<boolean>;
$findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
}
@@ -1906,7 +1914,7 @@ export interface ExtHostDebugServiceShape {
$resolveDebugConfiguration(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined>;
$resolveDebugConfigurationWithSubstitutedVariables(handle: number, folder: UriComponents | undefined, debugConfiguration: IConfig, token: CancellationToken): Promise<IConfig | null | undefined>;
$provideDebugConfigurations(handle: number, folder: UriComponents | undefined, token: CancellationToken): Promise<IConfig[]>;
$provideDebugAdapter(handle: number, session: IDebugSessionDto): Promise<IAdapterDescriptor>;
$provideDebugAdapter(handle: number, session: IDebugSessionDto): Promise<Dto<IAdapterDescriptor>>;
$acceptDebugSessionStarted(session: IDebugSessionDto): void;
$acceptDebugSessionTerminated(session: IDebugSessionDto): void;
$acceptDebugSessionActiveChanged(session: IDebugSessionDto | undefined): void;
@@ -2146,7 +2154,7 @@ export interface ExtHostTunnelServiceShape {
}
export interface ExtHostTimelineShape {
$getTimeline(source: string, uri: UriComponents, options: TimelineOptions, token: CancellationToken, internalOptions?: InternalTimelineOptions): Promise<Timeline | undefined>;
$getTimeline(source: string, uri: UriComponents, options: TimelineOptions, token: CancellationToken, internalOptions?: InternalTimelineOptions): Promise<Dto<Timeline> | undefined>;
}
export const enum ExtHostTestingResource {
@@ -2164,7 +2172,7 @@ export interface ExtHostTestingShape {
/** Expands a test item's children, by the given number of levels. */
$expandTest(testId: string, levels: number): Promise<void>;
/** Requests file coverage for a test run. Errors if not available. */
$provideFileCoverage(runId: string, taskId: string, token: CancellationToken): Promise<IFileCoverage[]>;
$provideFileCoverage(runId: string, taskId: string, token: CancellationToken): Promise<Dto<IFileCoverage[]>>;
/**
* Requests coverage details for the file index in coverage data for the run.
* Requires file coverage to have been previously requested via $provideFileCoverage.

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 } from './extHost.protocol';
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ObjectIdentifier, 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';
@@ -276,7 +276,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
});
}
$getContributedCommandHandlerDescriptions(): Promise<{ [id: string]: string | ICommandHandlerDescription }> {
$getContributedCommandHandlerDescriptions(): Promise<{ [id: string]: string | ICommandHandlerDescriptionDto }> {
const result: { [id: string]: string | ICommandHandlerDescription } = Object.create(null);
for (let [id, command] of this._commands) {
let { description } = command;

View File

@@ -16,7 +16,7 @@ import { AbstractDebugAdapter } from 'vs/workbench/contrib/debug/common/abstract
import { IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
import { ExtHostDocumentsAndEditors, IExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
import { IDebuggerContribution, IConfig, IDebugAdapter, IDebugAdapterServer, IDebugAdapterExecutable, IAdapterDescriptor, IDebugAdapterImpl, IDebugAdapterNamedPipeServer } from 'vs/workbench/contrib/debug/common/debug';
import { IDebuggerContribution, IConfig, IDebugAdapter, IDebugAdapterServer, IDebugAdapterExecutable, IAdapterDescriptor, IDebugAdapterNamedPipeServer } from 'vs/workbench/contrib/debug/common/debug';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
import { ExtHostConfigProvider, IExtHostConfiguration } from '../common/extHostConfiguration';
@@ -32,6 +32,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { withNullAsUndefined } from 'vs/base/common/types';
import * as process from 'vs/base/common/process';
import { IExtHostEditorTabs } from 'vs/workbench/api/common/extHostEditorTabs';
import { Dto } from 'vs/workbench/services/extensions/common/proxyIdentifier';
export const IExtHostDebugService = createDecorator<IExtHostDebugService>('IExtHostDebugService');
@@ -642,7 +643,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
});
}
public async $provideDebugAdapter(adapterFactoryHandle: number, sessionDto: IDebugSessionDto): Promise<IAdapterDescriptor> {
public async $provideDebugAdapter(adapterFactoryHandle: number, sessionDto: IDebugSessionDto): Promise<Dto<IAdapterDescriptor>> {
const adapterDescriptorFactory = this.getAdapterDescriptorFactoryByHandle(adapterFactoryHandle);
if (!adapterDescriptorFactory) {
return Promise.reject(new Error('no adapter descriptor factory found for handle'));
@@ -693,7 +694,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
// private & dto helpers
private convertToDto(x: vscode.DebugAdapterDescriptor): IAdapterDescriptor {
private convertToDto(x: vscode.DebugAdapterDescriptor): Dto<IAdapterDescriptor> {
if (x instanceof DebugAdapterExecutable) {
return <IDebugAdapterExecutable>{
@@ -714,7 +715,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
path: x.path
};
} else if (x instanceof DebugAdapterInlineImplementation) {
return <IDebugAdapterImpl>{
return <Dto<IAdapterDescriptor>>{
type: 'implementation',
implementation: x.implementation
};

View File

@@ -543,7 +543,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
protected abstract provideTasksInternal(validTypes: { [key: string]: boolean; }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[], extension: IExtensionDescription };
public $provideTasks(handle: number, validTypes: { [key: string]: boolean; }): Thenable<tasks.TaskSetDTO> {
public $provideTasks(handle: number, validTypes: { [key: string]: boolean; }): Promise<tasks.TaskSetDTO> {
const handler = this._handlers.get(handle);
if (!handler) {
return Promise.reject(new Error('no handler found'));

View File

@@ -5,6 +5,7 @@
import { UriComponents } from 'vs/base/common/uri';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import type { Dto } from 'vs/workbench/services/extensions/common/proxyIdentifier';
export interface TaskDefinitionDTO {
type: string;
@@ -104,7 +105,7 @@ export interface TaskDTO {
export interface TaskSetDTO {
tasks: TaskDTO[];
extension: IExtensionDescription;
extension: Dto<IExtensionDescription>;
}
export interface TaskExecutionDTO {