Skip to content

Commit 2b3f8c8

Browse files
authored
Merge pull request microsoft#264777 from mjbvz/exotic-ferret
Don't allow dragging chat session history node
2 parents 62d0d43 + 2cadce3 commit 2b3f8c8

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/vs/workbench/contrib/chat/browser/chatSessions.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,15 @@ class LocalChatSessionsProvider extends Disposable implements IChatSessionItemPr
520520
});
521521

522522
// Add "Show history..." node at the end
523-
const historyNode: IChatSessionItem = {
524-
id: 'show-history',
525-
label: nls.localize('chat.sessions.showHistory', "History"),
526-
};
527-
528523
return [...sessions, historyNode];
529524
}
530525
}
531526

527+
const historyNode: IChatSessionItem = {
528+
id: 'show-history',
529+
label: nls.localize('chat.sessions.showHistory', "History"),
530+
};
531+
532532
// Chat sessions container
533533
class ChatSessionsViewPaneContainer extends ViewPaneContainer {
534534
private registeredViewDescriptors: Map<string, IViewDescriptor> = new Map();
@@ -762,7 +762,7 @@ class SessionsDataSource implements IAsyncDataSource<IChatSessionItemProvider, C
762762
}
763763

764764
// Check if this is the "Show history..." node
765-
if ('id' in element && element.id === 'show-history') {
765+
if ('id' in element && element.id === historyNode.id) {
766766
return true;
767767
}
768768

@@ -800,7 +800,7 @@ class SessionsDataSource implements IAsyncDataSource<IChatSessionItemProvider, C
800800
}
801801

802802
// Check if this is the "Show history..." node
803-
if ('id' in element && element.id === 'show-history') {
803+
if ('id' in element && element.id === historyNode.id) {
804804
return this.getHistoryItems();
805805
}
806806

@@ -1026,7 +1026,7 @@ class SessionsRenderer extends Disposable implements ITreeRenderer<IChatSessionI
10261026
// Handle different icon types
10271027
let iconResource: URI | undefined;
10281028
let iconTheme: ThemeIcon | undefined;
1029-
if (!session.iconPath && session.id !== 'show-history') {
1029+
if (!session.iconPath && session.id !== historyNode.id) {
10301030
iconTheme = this.statusToIcon(session.status);
10311031
} else {
10321032
iconTheme = session.iconPath;
@@ -1485,6 +1485,9 @@ class SessionsViewPane extends ViewPane {
14851485
}
14861486
},
14871487
getDragURI: (element: ChatSessionItemWithProvider) => {
1488+
if (element.id === historyNode.id) {
1489+
return null;
1490+
}
14881491
return getResourceForElement(element).toString();
14891492
},
14901493
getDragLabel: (elements: ChatSessionItemWithProvider[]) => {
@@ -1520,7 +1523,7 @@ class SessionsViewPane extends ViewPane {
15201523

15211524
// Register context menu event for right-click actions
15221525
this._register(this.tree.onContextMenu((e) => {
1523-
if (e.element && e.element.id !== 'show-history') {
1526+
if (e.element && e.element.id !== historyNode.id) {
15241527
this.showContextMenu(e);
15251528
}
15261529
}));
@@ -1600,7 +1603,7 @@ class SessionsViewPane extends ViewPane {
16001603
}
16011604

16021605
try {
1603-
if (element.id === 'show-history') {
1606+
if (element.id === historyNode.id) {
16041607
// Don't try to open the "Show history..." node itself
16051608
return;
16061609
}

0 commit comments

Comments
 (0)