-
Notifications
You must be signed in to change notification settings - Fork 36.4k
Hide more instances of Keep/Undo for non-local chat sessions #279267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ import { ThemeIcon } from '../../../../../base/common/themables.js'; | |
| import * as arrays from '../../../../../base/common/arrays.js'; | ||
| import { renderAsPlaintext } from '../../../../../base/browser/markdownRenderer.js'; | ||
| import { IKeybindingService } from '../../../../../platform/keybinding/common/keybinding.js'; | ||
| import { LocalChatSessionUri } from '../../common/chatUri.js'; | ||
|
|
||
| class ChatEditorOverlayWidget extends Disposable { | ||
|
|
||
|
|
@@ -379,6 +380,17 @@ class ChatEditingOverlayController { | |
| return chatModel.requestInProgress.read(r); | ||
| }); | ||
|
|
||
|
|
||
| const isLocalChat = derived(r => { | ||
|
|
||
| const session = sessionAndEntry.read(r)?.session; | ||
| if (!session) { | ||
| return false; | ||
| } | ||
| const chatModel = chatService.getSession(session.chatSessionResource)!; | ||
| return LocalChatSessionUri.parseLocalSessionId(chatModel.sessionResource); | ||
| }); | ||
|
Comment on lines
+384
to
+392
|
||
|
|
||
| this._store.add(autorun(r => { | ||
|
|
||
| const data = sessionAndEntry.read(r); | ||
|
|
@@ -397,8 +409,11 @@ class ChatEditingOverlayController { | |
| } | ||
|
|
||
| if ( | ||
| entry?.state.read(r) === ModifiedFileEntryState.Modified // any entry changing | ||
| || (!session.isGlobalEditingSession && isInProgress.read(r)) // inline chat request | ||
| isLocalChat.read(r) // display widget only for local chat sessions | ||
| && ( | ||
| entry?.state.read(r) === ModifiedFileEntryState.Modified // any entry changing | ||
| || (!session.isGlobalEditingSession && isInProgress.read(r)) // inline chat request | ||
| ) | ||
| ) { | ||
| // any session with changes | ||
| const editorPane = group.activeEditorPane; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value here is of type
string | undefined. The functionparseLocalSessionIdreturns the session ID string if it's a local session, orundefinedif it's not. While this works as a boolean expression (truthy string vs falsy undefined), it would be clearer and more semantically correct to convert it to an explicit boolean:or
This makes the intent explicit and ensures the derived observable has a consistent
booleantype rather thanstring | undefined.