Skip to content

Commit

Permalink
in testing copilot edit agent, start wip #241772
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Feb 25, 2025
1 parent d984cb5 commit c09d9ab
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/vs/platform/extensions/common/extensionsApiProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ const _allApiProposals = {
terminalShellType: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellType.d.ts',
},
terminalTaskStatus: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalTaskStatus.d.ts',
},
testObserver: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
},
Expand Down
6 changes: 4 additions & 2 deletions src/vs/workbench/api/browser/mainThreadTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import { ExtHostContext, MainThreadTaskShape, ExtHostTaskShape, MainContext } fr
import {
ITaskDefinitionDTO, ITaskExecutionDTO, IProcessExecutionOptionsDTO, ITaskPresentationOptionsDTO,
IProcessExecutionDTO, IShellExecutionDTO, IShellExecutionOptionsDTO, ICustomExecutionDTO, ITaskDTO, ITaskSourceDTO, ITaskHandleDTO, ITaskFilterDTO, ITaskProcessStartedDTO, ITaskProcessEndedDTO, ITaskSystemInfoDTO,
IRunOptionsDTO, ITaskGroupDTO
IRunOptionsDTO, ITaskGroupDTO,
TaskTerminalStatusDTO
} from '../common/shared/tasks.js';
import { IConfigurationResolverService } from '../../services/configurationResolver/common/configurationResolver.js';
import { ConfigurationTarget } from '../../../platform/configuration/common/configuration.js';
Expand Down Expand Up @@ -455,6 +456,8 @@ export class MainThreadTask extends Disposable implements MainThreadTaskShape {
} else if (event.kind === TaskEventKind.End) {
this._proxy.$OnDidEndTask(TaskExecutionDTO.from(task.getTaskExecution()));
}
//TODO@meganrogge fix
this._proxy.$onDidChangeTaskTerminalStatus(TaskTerminalStatusDTO.from({ terminalId: 1, status: event.kind.toString() }));
}));
}

Expand Down Expand Up @@ -735,5 +738,4 @@ export class MainThreadTask extends Disposable implements MainThreadTaskShape {
async $registerSupportedExecutions(custom?: boolean, shell?: boolean, process?: boolean): Promise<void> {
return this._taskService.registerSupportedExecutions(custom, shell, process);
}

}
5 changes: 5 additions & 0 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,11 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
onDidEndTaskProcess: (listeners, thisArgs?, disposables?) => {
return _asExtensionEvent(extHostTask.onDidEndTaskProcess)(listeners, thisArgs, disposables);
},
onDidChangeTaskStatus: (listeners, thisArgs?, disposables?) => {
// TODO@meganrogge
// checkProposedApiEnabled(extension, 'taskTerminalStatus');
return _asExtensionEvent(extHostTask.onDidChangeTaskTerminalStatus)(listeners, thisArgs, disposables);
}
};

Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2552,6 +2552,7 @@ export interface ExtHostTaskShape {
$onDidStartTaskProcess(value: tasks.ITaskProcessStartedDTO): void;
$onDidEndTaskProcess(value: tasks.ITaskProcessEndedDTO): void;
$OnDidEndTask(execution: tasks.ITaskExecutionDTO): void;
$onDidChangeTaskTerminalStatus(status: tasks.ITaskTerminalStatusDTO): void;
$resolveVariables(workspaceFolder: UriComponents, toResolve: { process?: { name: string; cwd?: string }; variables: string[] }): Promise<{ process?: string; variables: { [key: string]: string } }>;
$jsonTasksSupported(): Promise<boolean>;
$findExecutable(command: string, cwd?: string, paths?: string[]): Promise<string | undefined>;
Expand Down
14 changes: 14 additions & 0 deletions src/vs/workbench/api/common/extHostTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { IExtHostApiDeprecationService } from './extHostApiDeprecationService.js
import { USER_TASKS_GROUP_KEY } from '../../contrib/tasks/common/tasks.js';
import { ErrorNoTelemetry, NotSupportedError } from '../../../base/common/errors.js';
import { asArray } from '../../../base/common/arrays.js';
import { ITaskTerminalStatusDTO } from './shared/tasks.js';

export interface IExtHostTask extends ExtHostTaskShape {

Expand All @@ -39,6 +40,7 @@ export interface IExtHostTask extends ExtHostTaskShape {
onDidEndTask: Event<vscode.TaskEndEvent>;
onDidStartTaskProcess: Event<vscode.TaskProcessStartEvent>;
onDidEndTaskProcess: Event<vscode.TaskProcessEndEvent>;
onDidChangeTaskTerminalStatus: Event<vscode.TaskTerminalStatus>; // Fixed the event type back to Event<TaskTerminalStatus>

registerTaskProvider(extension: IExtensionDescription, type: string, provider: vscode.TaskProvider): vscode.Disposable;
registerTaskSystem(scheme: string, info: tasks.ITaskSystemInfoDTO): void;
Expand Down Expand Up @@ -406,6 +408,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask

protected readonly _onDidTaskProcessStarted: Emitter<vscode.TaskProcessStartEvent> = new Emitter<vscode.TaskProcessStartEvent>();
protected readonly _onDidTaskProcessEnded: Emitter<vscode.TaskProcessEndEvent> = new Emitter<vscode.TaskProcessEndEvent>();
protected readonly _onDidChangeTaskTerminalStatus: Emitter<vscode.TaskTerminalStatus> = new Emitter<vscode.TaskTerminalStatus>();

constructor(
@IExtHostRpcService extHostRpc: IExtHostRpcService,
Expand Down Expand Up @@ -540,6 +543,17 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
});
}

public get onDidChangeTaskTerminalStatus(): Event<vscode.TaskTerminalStatus> {
return this._onDidChangeTaskTerminalStatus.event;
}

public async $onDidChangeTaskTerminalStatus(value: ITaskTerminalStatusDTO): Promise<void> {
this._onDidChangeTaskTerminalStatus.fire({
terminalId: value.terminalId,
status: value.status
});
}

protected abstract provideTasksInternal(validTypes: { [key: string]: boolean }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.ITaskDTO[]; extension: IExtensionDescription };

public $provideTasks(handle: number, validTypes: { [key: string]: boolean }): Promise<tasks.ITaskSetDTO> {
Expand Down
26 changes: 26 additions & 0 deletions src/vs/workbench/api/common/shared/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,29 @@ export interface ITaskSystemInfoDTO {
authority: string;
platform: string;
}

export interface ITaskTerminalStatus {
terminalId: number;
status: string;
}

export interface ITaskTerminalStatusDTO {
terminalId: number;
status: string;
}

export namespace TaskTerminalStatusDTO {
export function from(value: ITaskTerminalStatus): ITaskTerminalStatusDTO {
return {
terminalId: value.terminalId,
status: value.status
};
}

export function to(value: ITaskTerminalStatusDTO): ITaskTerminalStatus {
return {
terminalId: value.terminalId,
status: value.status
};
}
}
1 change: 1 addition & 0 deletions src/vs/workbench/api/node/extHostTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { homedir } from 'os';
import { IExtHostVariableResolverProvider } from '../common/extHostVariableResolverService.js';

export class ExtHostTask extends ExtHostTaskBase {

constructor(
@IExtHostRpcService extHostRpc: IExtHostRpcService,
@IExtHostInitDataService initData: IExtHostInitDataService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { ITerminalGroupService, ITerminalService } from '../../terminal/browser/
import { ITerminalProfileResolverService } from '../../terminal/common/terminal.js';

import { ConfiguringTask, ContributedTask, CustomTask, ExecutionEngine, InMemoryTask, ITaskEvent, ITaskIdentifier, ITaskSet, JsonSchemaVersion, KeyedTaskIdentifier, RuntimeType, Task, TASK_RUNNING_STATE, TaskDefinition, TaskEventKind, TaskGroup, TaskRunSource, TaskSettingId, TaskSorter, TaskSourceKind, TasksSchemaProperties, USER_TASKS_GROUP_KEY } from '../common/tasks.js';
import { CustomExecutionSupportedContext, ICustomizationProperties, IProblemMatcherRunOptions, ITaskFilter, ITaskProvider, ITaskService, IWorkspaceFolderTaskResult, ProcessExecutionSupportedContext, ServerlessWebContext, ShellExecutionSupportedContext, TaskCommandsRegistered, TaskExecutionSupportedContext } from '../common/taskService.js';
import { CustomExecutionSupportedContext, ICustomizationProperties, IProblemMatcherRunOptions, ITaskFilter, ITaskProvider, ITaskService, ITaskTerminalStatus, IWorkspaceFolderTaskResult, ProcessExecutionSupportedContext, ServerlessWebContext, ShellExecutionSupportedContext, TaskCommandsRegistered, TaskExecutionSupportedContext } from '../common/taskService.js';
import { ITaskExecuteResult, ITaskResolver, ITaskSummary, ITaskSystem, ITaskSystemInfo, ITaskTerminateResponse, TaskError, TaskErrors, TaskExecuteKind } from '../common/taskSystem.js';
import { getTemplates as getTaskTemplates } from '../common/taskTemplates.js';

Expand Down Expand Up @@ -237,6 +237,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
public get isReconnected(): boolean { return this._tasksReconnected; }
private _onDidChangeTaskProviders = this._register(new Emitter<void>());
public onDidChangeTaskProviders = this._onDidChangeTaskProviders.event;
private _onDidChangeTaskTerminalStatus: Emitter<ITaskTerminalStatus> = new Emitter<ITaskTerminalStatus>();
public readonly onDidChangeTaskTerminalStatus: Event<ITaskTerminalStatus> = this._onDidChangeTaskTerminalStatus.event;

private _activatedTaskProviders: Set<string> = new Set();

Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/tasks/common/taskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,8 @@ export interface ITaskService {

extensionCallbackTaskComplete(task: Task, result: number | undefined): Promise<void>;
}

export interface ITaskTerminalStatus {
terminalId: number;
status: string;
}
20 changes: 20 additions & 0 deletions src/vscode-dts/vscode.proposed.terminalTaskStatus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/


declare module 'vscode' {
export interface TaskTerminalStatus {
terminalId: number;
status: string;
}
export namespace tasks {

/**
* An event that is emitted when the status of a terminal task changes.
*/
export const onDidChangeTaskStatus: Event<TaskTerminalStatus>;
}

}

0 comments on commit c09d9ab

Please sign in to comment.