Skip to content

Commit 46f202c

Browse files
authored
Merge branch 'main' into copilot/support-metered-connections
2 parents c708c35 + c13eb90 commit 46f202c

File tree

10 files changed

+57
-7
lines changed

10 files changed

+57
-7
lines changed

.github/instructions/chat.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
applyTo: '**/chat/**'
32
description: Chat feature area coding guidelines
43
---
54

.github/instructions/interactive.instructions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
applyTo: '**/interactive/**'
3-
description: Architecture documentation for VS Code interactive window component
2+
description: Architecture documentation for VS Code interactive window component. Use when working in folder
43
---
54

65
# Interactive Window

.github/instructions/learnings.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
applyTo: **
32
description: This document describes how to deal with learnings that you make. (meta instruction)
43
---
54

.github/instructions/notebook.instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
applyTo: '**/notebook/**'
32
description: Architecture documentation for VS Code notebook and interactive window components
43
---
54

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ configurationRegistry.registerConfiguration({
262262
description: nls.localize('chat.renderRelatedFiles', "Controls whether related files should be rendered in the chat input."),
263263
default: false
264264
},
265+
[ChatConfiguration.InlineReferencesStyle]: {
266+
type: 'string',
267+
enum: ['box', 'link'],
268+
enumDescriptions: [
269+
nls.localize('chat.inlineReferences.style.box', "Display file and symbol references as boxed widgets with icons."),
270+
nls.localize('chat.inlineReferences.style.link', "Display file and symbol references as simple blue links without icons.")
271+
],
272+
description: nls.localize('chat.inlineReferences.style', "Controls how file and symbol references are displayed in chat messages."),
273+
default: 'box'
274+
},
265275
'chat.notifyWindowOnConfirmation': {
266276
type: 'boolean',
267277
description: nls.localize('chat.notifyWindowOnConfirmation', "Controls whether a chat session should present the user with an OS notification when a confirmation is needed while the window is not in focus. This includes a window badge as well as notification toast."),

src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import { IChatContentInlineReference } from '../../../common/chatService/chatSer
4444
import { IChatWidgetService } from '../../chat.js';
4545
import { chatAttachmentResourceContextKey, hookUpSymbolAttachmentDragAndContextMenu } from '../../attachments/chatAttachmentWidgets.js';
4646
import { IChatMarkdownAnchorService } from './chatMarkdownAnchorService.js';
47+
import { IConfigurationService } from '../../../../../../platform/configuration/common/configuration.js';
48+
import { ChatConfiguration } from '../../../common/constants.js';
4749

4850
type ContentRefData =
4951
| { readonly kind: 'symbol'; readonly symbol: IWorkspaceSymbol }
@@ -113,6 +115,7 @@ export class InlineAnchorWidget extends Disposable {
113115
private readonly element: HTMLAnchorElement | HTMLElement,
114116
public readonly inlineReference: IChatContentInlineReference,
115117
private readonly metadata: InlineAnchorWidgetMetadata | undefined,
118+
@IConfigurationService private readonly configurationService: IConfigurationService,
116119
@IContextKeyService originalContextKeyService: IContextKeyService,
117120
@IContextMenuService contextMenuService: IContextMenuService,
118121
@IFileService fileService: IFileService,
@@ -248,6 +251,14 @@ export class InlineAnchorWidget extends Disposable {
248251
const relativeLabel = labelService.getUriLabel(location.uri, { relative: true });
249252
this._register(hoverService.setupManagedHover(getDefaultHoverDelegate('element'), element, relativeLabel));
250253

254+
// Apply link-style if configured
255+
this.updateAppearance();
256+
this._register(this.configurationService.onDidChangeConfiguration(e => {
257+
if (e.affectsConfiguration(ChatConfiguration.InlineReferencesStyle)) {
258+
this.updateAppearance();
259+
}
260+
}));
261+
251262
// Drag and drop
252263
if (this.data.kind !== 'symbol') {
253264
element.draggable = true;
@@ -268,6 +279,12 @@ export class InlineAnchorWidget extends Disposable {
268279
return this.element;
269280
}
270281

282+
private updateAppearance(): void {
283+
const style = this.configurationService.getValue<string>(ChatConfiguration.InlineReferencesStyle);
284+
const useLinkStyle = style === 'link';
285+
this.element.classList.toggle('link-style', useLinkStyle);
286+
}
287+
271288
private getCellIndex(location: URI) {
272289
const notebook = this.notebookDocumentService.getNotebook(location);
273290
const index = notebook?.getCellIndex(location) ?? -1;

src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatInlineAnchorWidget.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,26 @@
5959

6060
flex-shrink: 0;
6161
}
62+
63+
/* Link-style appearance - no box, no icon */
64+
.chat-inline-anchor-widget.link-style,
65+
.interactive-item-container .value .rendered-markdown .chat-inline-anchor-widget.link-style {
66+
border: none;
67+
background-color: transparent;
68+
padding: 0;
69+
margin: 0;
70+
color: var(--vscode-textLink-foreground);
71+
}
72+
73+
.chat-inline-anchor-widget.link-style:hover {
74+
background-color: transparent;
75+
text-decoration: underline;
76+
}
77+
78+
.chat-inline-anchor-widget.link-style .icon {
79+
display: none;
80+
}
81+
82+
.chat-inline-anchor-widget.link-style .icon-label {
83+
padding: 0;
84+
}

src/vs/workbench/contrib/chat/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export enum ChatConfiguration {
1616
ExtensionToolsEnabled = 'chat.extensionTools.enabled',
1717
RepoInfoEnabled = 'chat.repoInfo.enabled',
1818
EditRequests = 'chat.editRequests',
19+
InlineReferencesStyle = 'chat.inlineReferences.style',
1920
GlobalAutoApprove = 'chat.tools.global.autoApprove',
2021
AutoApproveEdits = 'chat.tools.edits.autoApprove',
2122
AutoApprovedUrls = 'chat.tools.urls.autoApprove',

src/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ export class PromptBody {
346346
// Match markdown links: [text](link)
347347
const linkMatch = line.matchAll(/\[(.*?)\]\((.+?)\)/g);
348348
for (const match of linkMatch) {
349+
if (match.index > 0 && line[match.index - 1] === '!') {
350+
continue; // skip image links
351+
}
349352
const linkEndOffset = match.index + match[0].length - 1; // before the parenthesis
350353
const linkStartOffset = match.index + match[0].length - match[2].length - 1;
351354
const range = new Range(i + 1, linkStartOffset + 1, i + 1, linkEndOffset + 1);

src/vs/workbench/contrib/chat/test/common/promptSyntax/service/newPromptsParser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ suite('NewPromptsParser', () => {
2222
/* 04 */`tools: ['tool1', 'tool2']`,
2323
/* 05 */'---',
2424
/* 06 */'This is an agent test.',
25-
/* 07 */'Here is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md).',
25+
/* 07 */'Here is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md) and an image ![image](./image.png).',
2626
].join('\n');
2727
const result = new PromptFileParser().parse(uri, content);
2828
assert.deepEqual(result.uri, uri);
@@ -42,7 +42,7 @@ suite('NewPromptsParser', () => {
4242
]);
4343
assert.deepEqual(result.body.range, { startLineNumber: 6, startColumn: 1, endLineNumber: 8, endColumn: 1 });
4444
assert.equal(result.body.offset, 75);
45-
assert.equal(result.body.getContent(), 'This is an agent test.\nHere is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md).');
45+
assert.equal(result.body.getContent(), 'This is an agent test.\nHere is a #tool:tool1 variable (and one with closing parenthesis after: #tool:tool-2) and a #file:./reference1.md as well as a [reference](./reference2.md) and an image ![image](./image.png).');
4646

4747
assert.deepEqual(result.body.fileReferences, [
4848
{ range: new Range(7, 99, 7, 114), content: './reference1.md', isMarkdownLink: false },

0 commit comments

Comments
 (0)