Skip to content

Commit bdcbf2f

Browse files
authored
Merge branch 'main' into tyriar/34103_241101
2 parents 5fc7d03 + 7d09f80 commit bdcbf2f

File tree

13 files changed

+118
-67
lines changed

13 files changed

+118
-67
lines changed

.vscode/notebooks/api.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "$REPO=repo:microsoft/vscode\n$MILESTONE=milestone:\"October 2024\""
10+
"value": "$REPO=repo:microsoft/vscode\n$MILESTONE=milestone:\"November 2024\""
1111
},
1212
{
1313
"kind": 1,

.vscode/notebooks/my-work.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "// list of repos we work in\n$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce\n\n// current milestone name\n$MILESTONE=milestone:\"October 2024\"\n"
10+
"value": "// list of repos we work in\n$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce\n\n// current milestone name\n$MILESTONE=milestone:\"November 2024\"\n"
1111
},
1212
{
1313
"kind": 1,

src/vs/editor/browser/gpu/atlas/textureAtlas.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { getActiveWindow } from '../../../../base/browser/dom.js';
77
import { CharCode } from '../../../../base/common/charCode.js';
8+
import { BugIndicatingError } from '../../../../base/common/errors.js';
89
import { Emitter, Event } from '../../../../base/common/event.js';
910
import { Disposable, dispose, MutableDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
1011
import { ThreeKeyMap } from '../../../../base/common/map.js';
@@ -22,7 +23,7 @@ export interface ITextureAtlasOptions {
2223
}
2324

2425
export class TextureAtlas extends Disposable {
25-
private _colorMap!: string[];
26+
private _colorMap?: string[];
2627
private readonly _warmUpTask: MutableDisposable<IdleTaskQueue> = this._register(new MutableDisposable());
2728
private readonly _warmedUpRasterizers = new Set<number>();
2829
private readonly _allocatorType: AllocatorType;
@@ -60,7 +61,9 @@ export class TextureAtlas extends Disposable {
6061
this._allocatorType = options?.allocatorType ?? 'slab';
6162

6263
this._register(Event.runAndSubscribe(this._themeService.onDidColorThemeChange, () => {
63-
// TODO: Clear entire atlas on theme change
64+
if (this._colorMap) {
65+
this.clear();
66+
}
6467
this._colorMap = this._themeService.getColorTheme().tokenColorMap;
6568
}));
6669

@@ -147,29 +150,33 @@ export class TextureAtlas extends Disposable {
147150
* is distrubuted over multiple idle callbacks to avoid blocking the main thread.
148151
*/
149152
private _warmUpAtlas(rasterizer: IGlyphRasterizer): void {
153+
const colorMap = this._colorMap;
154+
if (!colorMap) {
155+
throw new BugIndicatingError('Cannot warm atlas without color map');
156+
}
150157
this._warmUpTask.value?.clear();
151158
const taskQueue = this._warmUpTask.value = new IdleTaskQueue();
152159
// Warm up using roughly the larger glyphs first to help optimize atlas allocation
153160
// A-Z
154161
for (let code = CharCode.A; code <= CharCode.Z; code++) {
155162
taskQueue.enqueue(() => {
156-
for (const fgColor of this._colorMap.keys()) {
163+
for (const fgColor of colorMap.keys()) {
157164
this.getGlyph(rasterizer, String.fromCharCode(code), (fgColor << MetadataConsts.FOREGROUND_OFFSET) & MetadataConsts.FOREGROUND_MASK);
158165
}
159166
});
160167
}
161168
// a-z
162169
for (let code = CharCode.a; code <= CharCode.z; code++) {
163170
taskQueue.enqueue(() => {
164-
for (const fgColor of this._colorMap.keys()) {
171+
for (const fgColor of colorMap.keys()) {
165172
this.getGlyph(rasterizer, String.fromCharCode(code), (fgColor << MetadataConsts.FOREGROUND_OFFSET) & MetadataConsts.FOREGROUND_MASK);
166173
}
167174
});
168175
}
169176
// Remaining ascii
170177
for (let code = CharCode.ExclamationMark; code <= CharCode.Tilde; code++) {
171178
taskQueue.enqueue(() => {
172-
for (const fgColor of this._colorMap.keys()) {
179+
for (const fgColor of colorMap.keys()) {
173180
this.getGlyph(rasterizer, String.fromCharCode(code), (fgColor << MetadataConsts.FOREGROUND_OFFSET) & MetadataConsts.FOREGROUND_MASK);
174181
}
175182
});

src/vs/editor/browser/gpu/atlas/textureAtlasPage.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Event } from '../../../../base/common/event.js';
76
import { Disposable, toDisposable } from '../../../../base/common/lifecycle.js';
87
import { ThreeKeyMap } from '../../../../base/common/map.js';
98
import { ILogService, LogLevel } from '../../../../platform/log/common/log.js';
@@ -46,23 +45,19 @@ export class TextureAtlasPage extends Disposable implements IReadableTextureAtla
4645
pageSize: number,
4746
allocatorType: AllocatorType,
4847
@ILogService private readonly _logService: ILogService,
49-
@IThemeService private readonly _themeService: IThemeService,
48+
@IThemeService themeService: IThemeService,
5049
) {
5150
super();
5251

5352
this._canvas = new OffscreenCanvas(pageSize, pageSize);
53+
this._colorMap = themeService.getColorTheme().tokenColorMap;
5454

5555
switch (allocatorType) {
5656
case 'shelf': this._allocator = new TextureAtlasShelfAllocator(this._canvas, textureIndex); break;
5757
case 'slab': this._allocator = new TextureAtlasSlabAllocator(this._canvas, textureIndex); break;
5858
default: this._allocator = allocatorType(this._canvas, textureIndex); break;
5959
}
6060

61-
this._register(Event.runAndSubscribe(this._themeService.onDidColorThemeChange, () => {
62-
// TODO: Clear entire atlas on theme change
63-
this._colorMap = this._themeService.getColorTheme().tokenColorMap;
64-
}));
65-
6661
// Reduce impact of a memory leak if this object is not released
6762
this._register(toDisposable(() => {
6863
this._canvas.width = 1;

src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
4040

4141
private readonly canvas: HTMLCanvasElement;
4242

43+
private _initViewportData?: ViewportData[];
4344
private _lastViewportData?: ViewportData;
4445
private _lastViewLineOptions?: ViewLineOptions;
4546

@@ -285,6 +286,16 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
285286
// endregion Bind group
286287

287288
this._initialized = true;
289+
290+
// Render the initial viewport immediately after initialization
291+
if (this._initViewportData) {
292+
// HACK: Rendering multiple times in the same frame like this isn't ideal, but there
293+
// isn't an easy way to merge viewport data
294+
for (const viewportData of this._initViewportData) {
295+
this.renderText(viewportData);
296+
}
297+
this._initViewportData = undefined;
298+
}
288299
}
289300

290301
private _updateAtlasStorageBufferAndTexture() {
@@ -361,6 +372,9 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
361372
public renderText(viewportData: ViewportData): void {
362373
if (this._initialized) {
363374
return this._renderText(viewportData);
375+
} else {
376+
this._initViewportData = this._initViewportData ?? [];
377+
this._initViewportData.push(viewportData);
364378
}
365379
}
366380

src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ class SubmitWithoutDispatchingAction extends Action2 {
8585
precondition: ContextKeyExpr.and(
8686
ChatContextKeys.inputHasText,
8787
ChatContextKeys.requestInProgress.negate(),
88-
ContextKeyExpr.and(ChatContextKeys.___location.isEqualTo(ChatAgentLocation.Panel))),
88+
ContextKeyExpr.and(ContextKeyExpr.or(
89+
ChatContextKeys.___location.isEqualTo(ChatAgentLocation.Panel),
90+
ChatContextKeys.___location.isEqualTo(ChatAgentLocation.Editor),
91+
))),
8992
keybinding: {
9093
when: ChatContextKeys.inChatInput,
9194
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.Enter,
@@ -140,7 +143,8 @@ export class ChatSubmitSecondaryAgentAction extends Action2 {
140143
menu: {
141144
id: MenuId.ChatExecuteSecondary,
142145
group: 'group_1',
143-
order: 3
146+
order: 3,
147+
when: ContextKeyExpr.equals(ChatContextKeys.___location.key, ChatAgentLocation.Panel)
144148
},
145149
keybinding: {
146150
when: ChatContextKeys.inChatInput,
@@ -185,12 +189,22 @@ class SendToChatEditingAction extends Action2 {
185189
id: MenuId.ChatExecuteSecondary,
186190
group: 'group_1',
187191
order: 4,
188-
when: ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered, ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession))
192+
when: ContextKeyExpr.and(
193+
ChatContextKeys.enabled,
194+
ChatContextKeys.editingParticipantRegistered,
195+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession),
196+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.Editor)
197+
)
189198
},
190199
keybinding: {
191200
weight: KeybindingWeight.WorkbenchContrib,
192201
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter,
193-
when: ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered, ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession))
202+
when: ContextKeyExpr.and(
203+
ChatContextKeys.enabled,
204+
ChatContextKeys.editingParticipantRegistered,
205+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession),
206+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.Editor),
207+
)
194208
}
195209
});
196210
}
@@ -258,7 +272,9 @@ class SendToNewChatAction extends Action2 {
258272
f1: false,
259273
menu: {
260274
id: MenuId.ChatExecuteSecondary,
261-
group: 'group_2'
275+
group: 'group_2',
276+
when: ContextKeyExpr.equals(ChatContextKeys.___location.key, ChatAgentLocation.Panel)
277+
262278
},
263279
keybinding: {
264280
weight: KeybindingWeight.WorkbenchContrib,

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,27 @@ abstract class WorkingSetAction extends Action2 {
5757
abstract runWorkingSetAction(accessor: ServicesAccessor, currentEditingSession: IChatEditingSession, chatWidget: IChatWidget | undefined, ...uris: URI[]): any;
5858
}
5959

60+
registerAction2(class AddFileToWorkingSet extends WorkingSetAction {
61+
constructor() {
62+
super({
63+
id: 'chatEditing.addFileToWorkingSet',
64+
title: localize2('addFileToWorkingSet', 'Add File'),
65+
icon: Codicon.plus,
66+
menu: [{
67+
id: MenuId.ChatEditingWidgetModifiedFilesToolbar,
68+
when: ContextKeyExpr.equals(chatEditingWidgetFileStateContextKey.key, WorkingSetEntryState.Transient),
69+
order: 0,
70+
group: 'navigation'
71+
}],
72+
});
73+
}
74+
75+
async runWorkingSetAction(_accessor: ServicesAccessor, currentEditingSession: IChatEditingSession, _chatWidget: IChatWidget, ...uris: URI[]): Promise<void> {
76+
for (const uri of uris) {
77+
currentEditingSession.addFileToWorkingSet(uri);
78+
}
79+
}
80+
});
6081

6182
registerAction2(class RemoveFileFromWorkingSet extends WorkingSetAction {
6283
constructor() {

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ export class ChatEditingSession extends Disposable implements IChatEditingSessio
467467
}
468468

469469
addFileToWorkingSet(resource: URI) {
470-
if (!this._workingSet.has(resource)) {
470+
const state = this._workingSet.get(resource);
471+
if (state === undefined || state === WorkingSetEntryState.Transient) {
471472
this._workingSet.set(resource, WorkingSetEntryState.Attached);
472473

473474
// Convert all transient entries to attachments

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { isCodeEditor } from '../../../../editor/browser/editorBrowser.js';
66
import { localize2 } from '../../../../nls.js';
77
import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
88
import { Codicon } from '../../../../base/common/codicons.js';
9-
import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js';
9+
import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';
1010
import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
1111
import { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';
1212
import { CHAT_CATEGORY } from './actions/chatActions.js';
@@ -35,13 +35,7 @@ abstract class NavigateAction extends Action2 {
3535
weight: KeybindingWeight.EditorContrib,
3636
when: ContextKeyExpr.and(ctxHasEditorModification, EditorContextKeys.focus),
3737
},
38-
f1: true,
39-
menu: {
40-
id: MenuId.EditorTitle,
41-
group: 'navigation',
42-
order: next ? -100 : -101,
43-
when: ctxHasEditorModification
44-
}
38+
f1: true
4539
});
4640
}
4741

@@ -75,12 +69,7 @@ abstract class AcceptDiscardAction extends Action2 {
7569
icon: accept
7670
? Codicon.check
7771
: Codicon.discard,
78-
menu: {
79-
id: MenuId.EditorTitle,
80-
group: 'navigation',
81-
order: accept ? -103 : -102,
82-
when: ctxHasEditorModification
83-
}
72+
f1: true,
8473
});
8574
}
8675

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

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import { Range } from '../../../../editor/common/core/range.js';
1919
import { Codicon } from '../../../../base/common/codicons.js';
2020
import { ThemeIcon } from '../../../../base/common/themables.js';
2121
import { ChatEditorController } from './chatEditorController.js';
22+
import { IViewsService } from '../../../services/views/common/viewsService.js';
23+
import { EDITS_VIEW_ID } from './chat.js';
24+
import { ActionViewItem } from '../../../../base/browser/ui/actionbar/actionViewItems.js';
2225

2326
class ChatEditorOverlayWidget implements IOverlayWidget {
2427

@@ -33,20 +36,21 @@ class ChatEditorOverlayWidget implements IOverlayWidget {
3336
constructor(
3437
private readonly _editor: ICodeEditor,
3538
@IEditorService private readonly _editorService: IEditorService,
39+
@IViewsService private readonly _viewsService: IViewsService,
3640
@IInstantiationService instaService: IInstantiationService,
3741
) {
3842
this._domNode = document.createElement('div');
3943
this._domNode.classList.add('chat-editor-overlay-widget');
4044

41-
const progressNode = document.createElement('div');
42-
progressNode.classList.add('progress-container');
43-
progressNode.classList.add(...ThemeIcon.asClassNameArray(ThemeIcon.modify(Codicon.loading, 'spin')));
44-
this._domNode.appendChild(progressNode);
45-
46-
const toolbarContainer = document.createElement('div');
47-
toolbarContainer.classList.add('toolbar-container');
48-
this._domNode.appendChild(toolbarContainer);
49-
this._toolbar = instaService.createInstance(WorkbenchToolBar, toolbarContainer, {});
45+
this._toolbar = instaService.createInstance(WorkbenchToolBar, this._domNode, {
46+
telemetrySource: 'chatEditor.overlayToolbar',
47+
actionViewItemProvider: (action, options) => {
48+
if (action.id === 'accept' || action.id === 'discard') {
49+
return new ActionViewItem(undefined, action, { ...options, label: true, icon: false });
50+
}
51+
return undefined;
52+
}
53+
});
5054
}
5155

5256
dispose() {
@@ -104,9 +108,20 @@ class ChatEditorOverlayWidget implements IOverlayWidget {
104108
this._domNode.classList.toggle('busy', busy);
105109

106110
const groups = [[
111+
toAction({
112+
id: 'open',
113+
label: localize('open', 'Open Chat Edit'),
114+
class: ThemeIcon.asClassName(busy
115+
? ThemeIcon.modify(Codicon.loading, 'spin')
116+
: Codicon.goToEditingSession),
117+
run: async () => {
118+
await this._viewsService.openView(EDITS_VIEW_ID);
119+
}
120+
}),
107121
toAction({
108122
id: 'accept',
109-
label: localize('accept', 'Accept Chat Edits'),
123+
label: localize('accept', 'Accept'),
124+
tooltip: localize('acceptTooltip', 'Accept Chat Edits'),
110125
class: ThemeIcon.asClassName(Codicon.check),
111126
enabled: !busy && modified,
112127
run: () => {
@@ -116,7 +131,8 @@ class ChatEditorOverlayWidget implements IOverlayWidget {
116131
}),
117132
toAction({
118133
id: 'discard',
119-
label: localize('discard', 'Discard Chat Edits'),
134+
label: localize('discard', 'Discard'),
135+
tooltip: localize('discardTooltip', 'Discard Chat Edits'),
120136
class: ThemeIcon.asClassName(Codicon.discard),
121137
enabled: !busy && modified,
122138
run: () => {

0 commit comments

Comments
 (0)