Skip to content

Commit 021b605

Browse files
authored
Merge branch 'main' into fix/improve-marker-placements
2 parents 7b5f74d + dcfb696 commit 021b605

File tree

11 files changed

+58
-52
lines changed

11 files changed

+58
-52
lines changed

extensions/markdown-language-features/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ highlight.js@^11.8.0:
217217
integrity sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==
218218

219219
katex@^0.16.4:
220-
version "0.16.9"
221-
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.9.tgz#bc62d8f7abfea6e181250f85a56e4ef292dcb1fa"
222-
integrity sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==
220+
version "0.16.10"
221+
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.10.tgz#6f81b71ac37ff4ec7556861160f53bc5f058b185"
222+
integrity sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==
223223
dependencies:
224224
commander "^8.3.0"
225225

extensions/markdown-math/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ commander@^8.3.0:
2525
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
2626

2727
katex@^0.16.4:
28-
version "0.16.9"
29-
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.9.tgz#bc62d8f7abfea6e181250f85a56e4ef292dcb1fa"
30-
integrity sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==
28+
version "0.16.10"
29+
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.10.tgz#6f81b71ac37ff4ec7556861160f53bc5f058b185"
30+
integrity sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==
3131
dependencies:
3232
commander "^8.3.0"

src/vs/platform/quickinput/browser/quickInputTree.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as dom from 'vs/base/browser/dom';
77
import { Emitter, Event } from 'vs/base/common/event';
88
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
99
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
10-
import { IObjectTreeElement, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
10+
import { IObjectTreeElement, ITreeEvent, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
1111
import { localize } from 'vs/nls';
1212
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1313
import { WorkbenchObjectTree } from 'vs/platform/list/browser/listService';
@@ -696,6 +696,8 @@ export class QuickInputTree extends Disposable {
696696
private readonly _onSeparatorButtonTriggered = new Emitter<IQuickPickSeparatorButtonEvent>();
697697
onSeparatorButtonTriggered = this._onSeparatorButtonTriggered.event;
698698

699+
private readonly _onTriggerEmptySelectionOrFocus = new Emitter<ITreeEvent<IQuickPickElement | null>>();
700+
699701
private readonly _container: HTMLElement;
700702
private readonly _tree: WorkbenchObjectTree<IQuickPickElement, void>;
701703
private readonly _separatorRenderer: QuickPickSeparatorElementRenderer;
@@ -748,7 +750,7 @@ export class QuickInputTree extends Disposable {
748750
?? element.separator?.id
749751
?? element.separator?.label
750752
?? '';
751-
}
753+
},
752754
},
753755
alwaysConsumeMouseWheel: true
754756
}
@@ -762,15 +764,15 @@ export class QuickInputTree extends Disposable {
762764
@memoize
763765
get onDidChangeFocus() {
764766
return Event.map(
765-
this._tree.onDidChangeFocus,
767+
Event.any(this._tree.onDidChangeFocus, this._onTriggerEmptySelectionOrFocus.event),
766768
e => e.elements.filter((e): e is QuickPickItemElement => e instanceof QuickPickItemElement).map(e => e.item)
767769
);
768770
}
769771

770772
@memoize
771773
get onDidChangeSelection() {
772774
return Event.map(
773-
this._tree.onDidChangeSelection,
775+
Event.any(this._tree.onDidChangeSelection, this._onTriggerEmptySelectionOrFocus.event),
774776
e => ({
775777
items: e.elements.filter((e): e is QuickPickItemElement => e instanceof QuickPickItemElement).map(e => e.item),
776778
event: e.browserEvent
@@ -1504,7 +1506,15 @@ export class QuickInputTree extends Disposable {
15041506
});
15051507
}
15061508
}
1509+
const before = this._tree.getFocus().length;
15071510
this._tree.setChildren(null, elements);
1511+
// Temporary fix until we figure out why the tree doesn't fire an event when focus & selection
1512+
// get changed to empty arrays.
1513+
if (before > 0 && elements.length === 0) {
1514+
this._onTriggerEmptySelectionOrFocus.fire({
1515+
elements: []
1516+
});
1517+
}
15081518
this._tree.layout();
15091519

15101520
this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked());

src/vs/workbench/api/browser/mainThreadChat.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { Emitter } from 'vs/base/common/event';
77
import { Disposable, DisposableMap } from 'vs/base/common/lifecycle';
88
import { URI, UriComponents } from 'vs/base/common/uri';
9+
import { ILogService } from 'vs/platform/log/common/log';
910
import { ExtHostChatShape, ExtHostContext, MainContext, MainThreadChatShape } from 'vs/workbench/api/common/extHost.protocol';
1011
import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
1112
import { IChatContributionService } from 'vs/workbench/contrib/chat/common/chatContributionService';
@@ -24,25 +25,27 @@ export class MainThreadChat extends Disposable implements MainThreadChatShape {
2425
extHostContext: IExtHostContext,
2526
@IChatService private readonly _chatService: IChatService,
2627
@IChatWidgetService private readonly _chatWidgetService: IChatWidgetService,
27-
@IChatContributionService private readonly chatContribService: IChatContributionService,
28+
@IChatContributionService private readonly _chatContribService: IChatContributionService,
29+
@ILogService private readonly _logService: ILogService,
2830
) {
2931
super();
3032
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostChat);
3133
}
3234

33-
$transferChatSession(sessionId: number, toWorkspace: UriComponents): void {
34-
const sessionIdStr = this._chatService.getSessionId(sessionId);
35-
if (!sessionIdStr) {
36-
throw new Error(`Failed to transfer session. Unknown session provider ID: ${sessionId}`);
35+
$transferActiveChatSession(toWorkspace: UriComponents): void {
36+
const widget = this._chatWidgetService.lastFocusedWidget;
37+
const sessionId = widget?.viewModel?.model.sessionId;
38+
if (!sessionId) {
39+
this._logService.error(`MainThreadChat#$transferActiveChatSession: No active chat session found`);
40+
return;
3741
}
3842

39-
const widget = this._chatWidgetService.getWidgetBySessionId(sessionIdStr);
4043
const inputValue = widget?.inputEditor.getValue() ?? '';
41-
this._chatService.transferChatSession({ sessionId: sessionIdStr, inputValue: inputValue }, URI.revive(toWorkspace));
44+
this._chatService.transferChatSession({ sessionId, inputValue }, URI.revive(toWorkspace));
4245
}
4346

4447
async $registerChatProvider(handle: number, id: string): Promise<void> {
45-
const registration = this.chatContribService.registeredProviders.find(staticProvider => staticProvider.id === id);
48+
const registration = this._chatContribService.registeredProviders.find(staticProvider => staticProvider.id === id);
4649
if (!registration) {
4750
throw new Error(`Provider ${id} must be declared in the package.json.`);
4851
}

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,9 +1405,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
14051405
checkProposedApiEnabled(extension, 'interactive');
14061406
return extHostChat.registerChatProvider(extension, id, provider);
14071407
},
1408-
transferChatSession(session: vscode.InteractiveSession, toWorkspace: vscode.Uri) {
1408+
transferActiveChat(toWorkspace: vscode.Uri) {
14091409
checkProposedApiEnabled(extension, 'interactive');
1410-
return extHostChat.transferChatSession(session, toWorkspace);
1410+
return extHostChat.transferActiveChat(toWorkspace);
14111411
}
14121412
};
14131413

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ export interface MainThreadChatShape extends IDisposable {
13221322
$registerChatProvider(handle: number, id: string): Promise<void>;
13231323
$acceptChatState(sessionId: number, state: any): Promise<void>;
13241324
$unregisterChatProvider(handle: number): Promise<void>;
1325-
$transferChatSession(sessionId: number, toWorkspace: UriComponents): void;
1325+
$transferActiveChatSession(toWorkspace: UriComponents): void;
13261326
}
13271327

13281328
export interface ExtHostChatShape {

src/vs/workbench/api/common/extHostChat.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { CancellationToken } from 'vs/base/common/cancellation';
7-
import { Iterable } from 'vs/base/common/iterator';
87
import { toDisposable } from 'vs/base/common/lifecycle';
98
import { IRelaxedExtensionDescription } from 'vs/platform/extensions/common/extensions';
109
import { ExtHostChatShape, IChatDto, IMainContext, MainContext, MainThreadChatShape } from 'vs/workbench/api/common/extHost.protocol';
@@ -49,13 +48,8 @@ export class ExtHostChat implements ExtHostChatShape {
4948
});
5049
}
5150

52-
transferChatSession(session: vscode.InteractiveSession, newWorkspace: vscode.Uri): void {
53-
const sessionId = Iterable.find(this._chatSessions.keys(), key => this._chatSessions.get(key) === session) ?? 0;
54-
if (typeof sessionId !== 'number') {
55-
return;
56-
}
57-
58-
this._proxy.$transferChatSession(sessionId, newWorkspace);
51+
transferActiveChat(newWorkspace: vscode.Uri): void {
52+
this._proxy.$transferActiveChatSession(newWorkspace);
5953
}
6054

6155
async $prepareChat(handle: number, token: CancellationToken): Promise<IChatDto | undefined> {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,13 @@ export class ChatWidget extends Disposable implements IChatWidget {
538538

539539
let msg = '';
540540
if (e.followup.agentId && e.followup.agentId !== this.chatAgentService.getDefaultAgent(this.location)?.id) {
541-
msg = `${chatAgentLeader}${e.followup.agentId} `;
541+
const agent = this.chatAgentService.getAgent(e.followup.agentId);
542+
if (!agent) {
543+
return;
544+
}
545+
546+
this.lastSelectedAgent = agent;
547+
msg = `${chatAgentLeader}${agent.name} `;
542548
if (e.followup.subCommand) {
543549
msg += `${chatSubcommandLeader}${e.followup.subCommand} `;
544550
}

src/vs/workbench/contrib/codeEditor/electron-sandbox/startDebugTextMate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class StartDebugTextMate extends Action2 {
2929
constructor() {
3030
super({
3131
id: 'editor.action.startDebugTextMate',
32-
title: nls.localize2('startDebugTextMate', "Start Text Mate Syntax Grammar Logging"),
32+
title: nls.localize2('startDebugTextMate', "Start TextMate Syntax Grammar Logging"),
3333
category: Categories.Developer,
3434
f1: true
3535
});

src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController.ts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -381,28 +381,21 @@ export class TerminalChatController extends Disposable implements ITerminalContr
381381
if (!providerInfo) {
382382
return;
383383
}
384-
const model = this._model.value;
385384
const widget = await this._chatWidgetService.revealViewForProvider(providerInfo.id);
386-
if (widget) {
387-
if (widget.viewModel && model) {
388-
for (const request of model.getRequests()) {
389-
if (request.response?.response.value || request.response?.result) {
390-
this._chatService.addCompleteRequest(widget.viewModel.sessionId,
391-
request.message as IParsedChatRequest,
392-
request.variableData,
393-
{
394-
message: request.response.response.value,
395-
result: request.response.result,
396-
followups: request.response.followups
397-
});
398-
}
399-
}
400-
widget.focusLastMessage();
401-
} else if (!model) {
402-
widget.focusInput();
403-
}
404-
this._chatWidget?.rawValue?.hide();
385+
const request = this._currentRequest;
386+
if (!widget || !request?.response) {
387+
return;
405388
}
389+
this._chatService.addCompleteRequest(widget!.viewModel!.sessionId,
390+
request.message.text,
391+
request.variableData,
392+
{
393+
message: request.response!.response.value,
394+
result: request.response!.result,
395+
followups: request.response!.followups
396+
});
397+
widget.focusLastMessage();
398+
this._chatWidget?.rawValue?.hide();
406399
}
407400

408401
// TODO: Move to register calls, don't override

0 commit comments

Comments
 (0)