mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-19 17:58:39 +00:00
shortcut to open untitled editor (#279440)
This commit is contained in:
@@ -40,6 +40,7 @@ import { IChatWidgetService } from '../chat.js';
|
||||
import { CHAT_SETUP_ACTION_ID } from './chatActions.js';
|
||||
import { CancellationToken } from '../../../../../base/common/cancellation.js';
|
||||
import { PromptFileVariableKind, toPromptFileVariableEntry } from '../../common/chatVariableEntries.js';
|
||||
import { NEW_CHAT_SESSION_ACTION_ID } from '../chatSessions/common.js';
|
||||
|
||||
export const enum ActionLocation {
|
||||
ChatWidget = 'chatWidget',
|
||||
@@ -197,25 +198,28 @@ export class ChatContinueInSessionActionItem extends ActionWidgetDropdownActionV
|
||||
class CreateRemoteAgentJobAction {
|
||||
constructor() { }
|
||||
|
||||
private openUntitledEditor(commandService: ICommandService, continuationTarget: IChatSessionsExtensionPoint) {
|
||||
commandService.executeCommand(`${NEW_CHAT_SESSION_ACTION_ID}.${continuationTarget.type}`);
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor, continuationTarget: IChatSessionsExtensionPoint) {
|
||||
const contextKeyService = accessor.get(IContextKeyService);
|
||||
const commandService = accessor.get(ICommandService);
|
||||
const widgetService = accessor.get(IChatWidgetService);
|
||||
const chatAgentService = accessor.get(IChatAgentService);
|
||||
const chatService = accessor.get(IChatService);
|
||||
const editorService = accessor.get(IEditorService);
|
||||
|
||||
const remoteJobCreatingKey = ChatContextKeys.remoteJobCreating.bindTo(contextKeyService);
|
||||
|
||||
try {
|
||||
remoteJobCreatingKey.set(true);
|
||||
|
||||
const widgetService = accessor.get(IChatWidgetService);
|
||||
const chatAgentService = accessor.get(IChatAgentService);
|
||||
const chatService = accessor.get(IChatService);
|
||||
const editorService = accessor.get(IEditorService);
|
||||
|
||||
const widget = widgetService.lastFocusedWidget;
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
if (!widget.viewModel) {
|
||||
return;
|
||||
if (!widget || !widget.viewModel) {
|
||||
return this.openUntitledEditor(commandService, continuationTarget);
|
||||
}
|
||||
|
||||
// todo@connor4312: remove 'as' cast
|
||||
const chatModel = widget.viewModel.model as ChatModel;
|
||||
if (!chatModel) {
|
||||
@@ -227,8 +231,7 @@ class CreateRemoteAgentJobAction {
|
||||
let userPrompt = widget.getInput();
|
||||
if (!userPrompt) {
|
||||
if (!chatRequests.length) {
|
||||
// Nothing to do
|
||||
return;
|
||||
return this.openUntitledEditor(commandService, continuationTarget);
|
||||
}
|
||||
userPrompt = 'implement this.';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user