mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
Rename "subcommand" to "command" (#204911)
* Rename "subcommand" to "command" * Fix build
This commit is contained in:
parent
28cc5986c2
commit
b2f1748501
|
@ -37,8 +37,8 @@ suite('chat', () => {
|
|||
return null;
|
||||
});
|
||||
agent.isDefault = true;
|
||||
agent.subCommandProvider = {
|
||||
provideSubCommands: (_token) => {
|
||||
agent.commandProvider = {
|
||||
provideCommands: (_token) => {
|
||||
return [{ name: 'hello', description: 'Hello' }];
|
||||
}
|
||||
};
|
||||
|
@ -50,7 +50,7 @@ suite('chat', () => {
|
|||
const deferred = getDeferredForRequest();
|
||||
interactive.sendInteractiveRequestToProvider('provider', { message: '@agent /hello friend' });
|
||||
const request = await deferred.p;
|
||||
assert.deepStrictEqual(request.subCommand, 'hello');
|
||||
assert.deepStrictEqual(request.command, 'hello');
|
||||
assert.strictEqual(request.prompt, 'friend');
|
||||
});
|
||||
|
||||
|
@ -83,8 +83,8 @@ suite('chat', () => {
|
|||
return { metadata: { key: 'value' } };
|
||||
});
|
||||
agent.isDefault = true;
|
||||
agent.subCommandProvider = {
|
||||
provideSubCommands: (_token) => {
|
||||
agent.commandProvider = {
|
||||
provideCommands: (_token) => {
|
||||
return [{ name: 'hello', description: 'Hello' }];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -338,7 +338,7 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
|
|||
|
||||
class ExtHostChatAgent {
|
||||
|
||||
private _subCommandProvider: vscode.ChatAgentSubCommandProvider | undefined;
|
||||
private _commandProvider: vscode.ChatAgentCommandProvider | undefined;
|
||||
private _followupProvider: vscode.ChatAgentFollowupProvider | undefined;
|
||||
private _description: string | undefined;
|
||||
private _fullName: string | undefined;
|
||||
|
@ -379,10 +379,10 @@ class ExtHostChatAgent {
|
|||
}
|
||||
|
||||
async provideSlashCommands(token: CancellationToken): Promise<IChatAgentCommand[]> {
|
||||
if (!this._subCommandProvider) {
|
||||
if (!this._commandProvider) {
|
||||
return [];
|
||||
}
|
||||
const result = await this._subCommandProvider.provideSubCommands(token);
|
||||
const result = await this._commandProvider.provideCommands(token);
|
||||
if (!result) {
|
||||
return [];
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ class ExtHostChatAgent {
|
|||
'dark' in this._iconPath ? this._iconPath.dark :
|
||||
undefined,
|
||||
themeIcon: this._iconPath instanceof extHostTypes.ThemeIcon ? this._iconPath : undefined,
|
||||
hasSlashCommands: this._subCommandProvider !== undefined,
|
||||
hasSlashCommands: this._commandProvider !== undefined,
|
||||
hasFollowups: this._followupProvider !== undefined,
|
||||
isDefault: this._isDefault,
|
||||
isSecondary: this._isSecondary,
|
||||
|
@ -501,11 +501,11 @@ class ExtHostChatAgent {
|
|||
that._iconPath = v;
|
||||
updateMetadataSoon();
|
||||
},
|
||||
get subCommandProvider() {
|
||||
return that._subCommandProvider;
|
||||
get commandProvider() {
|
||||
return that._commandProvider;
|
||||
},
|
||||
set subCommandProvider(v) {
|
||||
that._subCommandProvider = v;
|
||||
set commandProvider(v) {
|
||||
that._commandProvider = v;
|
||||
updateMetadataSoon();
|
||||
},
|
||||
get followupProvider() {
|
||||
|
@ -606,7 +606,7 @@ class ExtHostChatAgent {
|
|||
,
|
||||
dispose() {
|
||||
disposed = true;
|
||||
that._subCommandProvider = undefined;
|
||||
that._commandProvider = undefined;
|
||||
that._followupProvider = undefined;
|
||||
that._onDidReceiveFeedback.dispose();
|
||||
that._proxy.$unregisterAgent(that._handle);
|
||||
|
|
|
@ -2610,7 +2610,7 @@ export namespace ChatAgentRequest {
|
|||
return {
|
||||
prompt: request.message,
|
||||
variables: ChatVariable.objectTo(request.variables),
|
||||
subCommand: request.command,
|
||||
command: request.command,
|
||||
agentId: request.agentId,
|
||||
};
|
||||
}
|
||||
|
|
35
src/vscode-dts/vscode.proposed.chatAgents2.d.ts
vendored
35
src/vscode-dts/vscode.proposed.chatAgents2.d.ts
vendored
|
@ -123,12 +123,12 @@ declare module 'vscode' {
|
|||
readonly kind: ChatAgentResultFeedbackKind;
|
||||
}
|
||||
|
||||
export interface ChatAgentSubCommand {
|
||||
export interface ChatAgentCommand {
|
||||
/**
|
||||
* A short name by which this command is referred to in the UI, e.g. `fix` or
|
||||
* `explain` for commands that fix an issue or explain code.
|
||||
*
|
||||
* **Note**: The name should be unique among the subCommands provided by this agent.
|
||||
* **Note**: The name should be unique among the commands provided by this agent.
|
||||
*/
|
||||
readonly name: string;
|
||||
|
||||
|
@ -138,40 +138,39 @@ declare module 'vscode' {
|
|||
readonly description: string;
|
||||
|
||||
/**
|
||||
* When the user clicks this subCommand in `/help`, this text will be submitted to this subCommand
|
||||
* When the user clicks this command in `/help`, this text will be submitted to this command
|
||||
*/
|
||||
readonly sampleRequest?: string;
|
||||
|
||||
/**
|
||||
* Whether executing the command puts the
|
||||
* chat into a persistent mode, where the
|
||||
* subCommand is prepended to the chat input.
|
||||
* command is prepended to the chat input.
|
||||
*/
|
||||
readonly shouldRepopulate?: boolean;
|
||||
|
||||
/**
|
||||
* Placeholder text to render in the chat input
|
||||
* when the subCommand has been repopulated.
|
||||
* when the command has been repopulated.
|
||||
* Has no effect if `shouldRepopulate` is `false`.
|
||||
*/
|
||||
// TODO@API merge this with shouldRepopulate? so that invalid state cannot be represented?
|
||||
readonly followupPlaceholder?: string;
|
||||
}
|
||||
|
||||
// TODO@API NAME: w/o Sub just `ChatAgentCommand` etc pp
|
||||
export interface ChatAgentSubCommandProvider {
|
||||
export interface ChatAgentCommandProvider {
|
||||
|
||||
/**
|
||||
* Returns a list of subCommands that its agent is capable of handling. A subCommand
|
||||
* Returns a list of commands that its agent is capable of handling. A command
|
||||
* can be selected by the user and will then be passed to the {@link ChatAgentHandler handler}
|
||||
* via the {@link ChatAgentRequest.subCommand subCommand} property.
|
||||
* via the {@link ChatAgentRequest.command command} property.
|
||||
*
|
||||
*
|
||||
* @param token A cancellation token.
|
||||
* @returns A list of subCommands. The lack of a result can be signaled by returning `undefined`, `null`, or
|
||||
* @returns A list of commands. The lack of a result can be signaled by returning `undefined`, `null`, or
|
||||
* an empty array.
|
||||
*/
|
||||
provideSubCommands(token: CancellationToken): ProviderResult<ChatAgentSubCommand[]>;
|
||||
provideCommands(token: CancellationToken): ProviderResult<ChatAgentCommand[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,9 +237,9 @@ declare module 'vscode' {
|
|||
} | ThemeIcon;
|
||||
|
||||
/**
|
||||
* This provider will be called to retrieve the agent's subCommands.
|
||||
* This provider will be called to retrieve the agent's commands.
|
||||
*/
|
||||
subCommandProvider?: ChatAgentSubCommandProvider;
|
||||
commandProvider?: ChatAgentCommandProvider;
|
||||
|
||||
/**
|
||||
* This provider will be called once after each request to retrieve suggested followup questions.
|
||||
|
@ -258,7 +257,7 @@ declare module 'vscode' {
|
|||
// onDidClearResult(value: TResult): void;
|
||||
|
||||
/**
|
||||
* When the user clicks this agent in `/help`, this text will be submitted to this subCommand
|
||||
* When the user clicks this agent in `/help`, this text will be submitted to this command
|
||||
*/
|
||||
sampleRequest?: string;
|
||||
|
||||
|
@ -280,10 +279,10 @@ declare module 'vscode' {
|
|||
export interface ChatAgentRequest {
|
||||
|
||||
/**
|
||||
* The prompt entered by the user. The {@link ChatAgent2.name name} of the agent or the {@link ChatAgentSubCommand.name subCommand}
|
||||
* The prompt entered by the user. The {@link ChatAgent2.name name} of the agent or the {@link ChatAgentCommand.name command}
|
||||
* are not part of the prompt.
|
||||
*
|
||||
* @see {@link ChatAgentRequest.subCommand}
|
||||
* @see {@link ChatAgentRequest.command}
|
||||
*/
|
||||
prompt: string;
|
||||
|
||||
|
@ -293,9 +292,9 @@ declare module 'vscode' {
|
|||
agentId: string;
|
||||
|
||||
/**
|
||||
* The name of the {@link ChatAgentSubCommand subCommand} that was selected for this request.
|
||||
* The name of the {@link ChatAgentCommand command} that was selected for this request.
|
||||
*/
|
||||
subCommand?: string;
|
||||
command?: string;
|
||||
|
||||
variables: Record<string, ChatVariableValue[]>;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ declare module 'vscode' {
|
|||
// TODO@API fit this into the stream
|
||||
export interface ChatAgentDetectedAgent {
|
||||
agentName: string;
|
||||
command?: ChatAgentSubCommand;
|
||||
command?: ChatAgentCommand;
|
||||
}
|
||||
|
||||
// TODO@API fit this into the stream
|
||||
|
|
Loading…
Reference in a new issue