From 4443613b98768e57b05ece24131a764895c46387 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 29 Aug 2024 14:59:12 +0200 Subject: [PATCH] release stashed session on blur (#227071) * only show secondary toolbar on hover or when container contains focus fixes https://github.com/microsoft/vscode/issues/226997 * release stashed session on blur fixes https://github.com/microsoft/vscode-copilot/issues/7802 --- .../contrib/inlineChat/browser/inlineChatSession.ts | 2 +- .../contrib/inlineChat/browser/inlineChatWidget.ts | 4 ++-- .../contrib/inlineChat/browser/media/inlineChat.css | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.ts index 82c395d21e2..f5b111e5109 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.ts @@ -263,7 +263,7 @@ export class StashedSession { // keep session for a little bit, only release when user continues to work (type, move cursor, etc.) this._session = session; this._ctxHasStashedSession.set(true); - this._listener = Event.once(Event.any(editor.onDidChangeCursorSelection, editor.onDidChangeModelContent, editor.onDidChangeModel))(() => { + this._listener = Event.once(Event.any(editor.onDidChangeCursorSelection, editor.onDidChangeModelContent, editor.onDidChangeModel, editor.onDidBlurEditorWidget))(() => { this._session = undefined; this._sessionService.releaseSession(session); this._ctxHasStashedSession.reset(); diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts index 91a572c2ee6..e04238505dd 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts @@ -96,9 +96,9 @@ export class InlineChatWidget { h('div.accessibleViewer@accessibleViewer'), h('div.status@status', [ h('div.label.info.hidden@infoLabel'), - h('div.actions.button-style.hidden@toolbar1'), + h('div.actions.hidden@toolbar1'), h('div.label.status.hidden@statusLabel'), - h('div.actions.button-style.hidden@toolbar2'), + h('div.actions.secondary.hidden@toolbar2'), ]), ] ); diff --git a/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css b/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css index f79ae5a6a9f..d8fac56650a 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css +++ b/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css @@ -171,6 +171,16 @@ gap: 4px; } +.monaco-workbench .inline-chat .status .actions.secondary { + display: none; +} + +.monaco-workbench .inline-chat .status:hover .actions.secondary, +.monaco-workbench .inline-chat:focus .status .actions.secondary, +.monaco-workbench .inline-chat .status:focus-within .actions.secondary { + display: inherit; +} + .monaco-workbench .inline-chat-diff-overlay { .monaco-button {