diff --git a/.vscode/sessions.json b/.vscode/sessions.json index 539b14b5dd4..dceaccd279e 100644 --- a/.vscode/sessions.json +++ b/.vscode/sessions.json @@ -1,28 +1,28 @@ { "scripts": [ { - "name": "run Windows", - "command": "code.bat" + "name": "Run (Windows)", + "command": ".\\scripts\\code.bat" }, { - "name": "run macOS", - "command": "code.sh" + "name": "Run (macOS)", + "command": "./scripts/code.sh" }, { - "name": "run Linux", - "command": "code.sh" + "name": "Run (Linux)", + "command": "./scripts/code.sh" }, { - "name": "run tests Windows", - "command": "test.bat" + "name": "Tests (Windows)", + "command": ".\\scripts\\test.bat" }, { - "name": "run tests macOS", - "command": "test.sh" + "name": "Tests (macOS)", + "command": "./scripts/test.sh" }, { - "name": "run tests Linux", - "command": "test.sh" + "name": "Tests (Linux)", + "command": "./scripts/test.sh" } ] } diff --git a/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackEditorInputContribution.ts b/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackEditorInputContribution.ts index 7e17e30caf3..bfc4bd97f7e 100644 --- a/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackEditorInputContribution.ts +++ b/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackEditorInputContribution.ts @@ -103,7 +103,10 @@ export class AgentFeedbackEditorInputContribution extends Disposable implements this._updatePosition(); } })); - this._store.add(this._editor.onMouseDown(() => { + this._store.add(this._editor.onMouseDown((e) => { + if (this._isWidgetTarget(e.event.target)) { + return; + } this._mouseDown = true; this._hide(); })); @@ -111,10 +114,28 @@ export class AgentFeedbackEditorInputContribution extends Disposable implements this._mouseDown = false; this._onSelectionChanged(); })); - this._store.add(this._editor.onDidBlurEditorWidget(() => this._hide())); + this._store.add(this._editor.onDidBlurEditorWidget(() => { + if (!this._visible) { + return; + } + // Defer so focus has settled to the new target + getWindow(this._editor.getDomNode()!).setTimeout(() => { + if (!this._visible) { + return; + } + if (this._isWidgetTarget(getWindow(this._editor.getDomNode()!).document.activeElement)) { + return; + } + this._hide(); + }, 0); + })); this._store.add(this._editor.onDidFocusEditorWidget(() => this._onSelectionChanged())); } + private _isWidgetTarget(target: EventTarget | Element | null): boolean { + return !!this._widget && !!target && this._widget.getDomNode().contains(target as Node); + } + private _ensureWidget(): AgentFeedbackInputWidget { if (!this._widget) { this._widget = new AgentFeedbackInputWidget(this._editor); @@ -240,6 +261,20 @@ export class AgentFeedbackEditorInputContribution extends Disposable implements this._widgetListeners.add(addStandardDisposableListener(widget.inputElement, 'keypress', e => { e.stopPropagation(); })); + + // Hide when input loses focus to something outside both editor and widget + this._widgetListeners.add(addStandardDisposableListener(widget.inputElement, 'blur', () => { + const win = getWindow(widget.inputElement); + win.setTimeout(() => { + if (!this._visible) { + return; + } + if (this._editor.hasWidgetFocus()) { + return; + } + this._hide(); + }, 0); + })); } private _submit(widget: AgentFeedbackInputWidget): void { diff --git a/src/vs/sessions/contrib/chat/browser/runScriptAction.ts b/src/vs/sessions/contrib/chat/browser/runScriptAction.ts index 914bfe03961..dfa11fd710d 100644 --- a/src/vs/sessions/contrib/chat/browser/runScriptAction.ts +++ b/src/vs/sessions/contrib/chat/browser/runScriptAction.ts @@ -75,15 +75,16 @@ export class RunScriptContribution extends Disposable implements IWorkbenchContr const { scripts, cwd, session } = activeSession; const configureScriptPrecondition = session.worktree ? ContextKeyExpr.true() : ContextKeyExpr.false(); + const addRunActionDisabledTooltip = session.worktree ? undefined : localize('configureScriptTooltipDisabled', "Actions can not be added in empty sessions"); if (scripts.length === 0) { - // No scripts configured - show a "Run Script" button that opens the configure quick pick + // No scripts configured - show a "Run Action" button that opens the configure quick pick reader.store.add(registerAction2(class extends Action2 { constructor() { super({ id: RUN_SCRIPT_ACTION_ID, - title: localize('runScriptNoAction', "Run Script"), - tooltip: localize('runScriptTooltipNoAction', "Configure run action"), + title: localize('runScriptNoAction', "Run Action..."), + tooltip: localize('runScriptTooltipNoAction', "Configure action"), icon: Codicon.play, category: localize2('agentSessions', 'Agent Sessions'), precondition: configureScriptPrecondition, @@ -111,7 +112,7 @@ export class RunScriptContribution extends Disposable implements IWorkbenchContr super({ id: actionId, title: script.name, - tooltip: localize('runScriptTooltip', "Run '{0}' in terminal", script.name), + tooltip: localize('runActionTooltip', "Run '{0}' in terminal", script.name), icon: Codicon.play, category: localize2('agentSessions', 'Agent Sessions'), menu: [{ @@ -134,9 +135,10 @@ export class RunScriptContribution extends Disposable implements IWorkbenchContr constructor() { super({ id: CONFIGURE_DEFAULT_RUN_ACTION_ID, - title: localize2('configureDefaultRunAction', "Add Run Script..."), + title: localize2('configureDefaultRunAction', "Add Action..."), + tooltip: addRunActionDisabledTooltip, category: localize2('agentSessions', 'Agent Sessions'), - icon: Codicon.add, + icon: Codicon.play, precondition: configureScriptPrecondition, menu: [{ id: RunScriptDropdownMenuId, diff --git a/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts b/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts index 86a963db393..8ac2ffd7a0c 100644 --- a/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts +++ b/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts @@ -25,7 +25,6 @@ import { IWorkspaceContextService } from '../../../../platform/workspace/common/ import { IWorkspaceEditingService } from '../../../../workbench/services/workspaces/common/workspaceEditing.js'; import { IViewsService } from '../../../../workbench/services/views/common/viewsService.js'; import { AgentSessionProviders } from '../../../../workbench/contrib/chat/browser/agentSessions/agentSessions.js'; -import { localize } from '../../../../nls.js'; export const IsNewChatSessionContext = new RawContextKey('isNewChatSession', true); @@ -243,7 +242,7 @@ export class SessionsManagementService extends Disposable implements ISessionsMa const chatsSession = await this.chatSessionsService.getOrCreateChatSession(pendingSessionResource, CancellationToken.None); const chatSessionItem: IChatSessionItem = { resource: chatsSession.sessionResource, - label: localize('sessionsManagement.newPendingAgentSessionLabel', 'Pending Session'), + label: '', timing: { created: Date.now(), lastRequestStarted: undefined,