diff --git a/src/extension/linkify/common/filePathLinkifier.ts b/src/extension/linkify/common/filePathLinkifier.ts index 1571f2c53e..1f899c5db0 100644 --- a/src/extension/linkify/common/filePathLinkifier.ts +++ b/src/extension/linkify/common/filePathLinkifier.ts @@ -20,9 +20,6 @@ import { IContributedLinkifier, LinkifierContext } from './linkifyService'; // Create a single regex which runs different regexp parts in a big `|` expression. const pathMatchRe = new RegExp( [ - // [path/to/file.md](path/to/file.md) or [`path/to/file.md`](path/to/file.md) - /\[(`?)(?[^`\]\)\n]+)\1\]\((?[^`\s]+)\)/.source, - // Inline code paths /(?[^`\s]+)`(?!\])/.source, @@ -35,8 +32,8 @@ const pathMatchRe = new RegExp( * Linkifies file paths in responses. This includes: * * ``` - * [file.md](file.md) * `file.md` + * foo.ts * ``` */ export class FilePathLinkifier implements IContributedLinkifier { @@ -58,28 +55,15 @@ export class FilePathLinkifier implements IContributedLinkifier { const matched = match[0]; - let pathText: string | undefined; - - // For a md style link, require that the text and path are the same - // However we have to have extra logic since the path may be encoded: `[file name](file%20name)` - if (match.groups?.['mdLinkPath']) { - let mdLinkPath = match.groups?.['mdLinkPath']; - try { - mdLinkPath = decodeURIComponent(mdLinkPath); - } catch { - // noop - } - - if (mdLinkPath !== match.groups?.['mdLinkText']) { - pathText = undefined; - } else { - pathText = mdLinkPath; - } - } - pathText ??= match.groups?.['inlineCodePath'] ?? match.groups?.['plainTextPath'] ?? ''; + const pathText = match.groups?.['inlineCodePath'] ?? match.groups?.['plainTextPath'] ?? ''; parts.push(this.resolvePathText(pathText, context) - .then(uri => uri ? new LinkifyLocationAnchor(uri) : matched)); + .then(uri => { + if (uri) { + return new LinkifyLocationAnchor(uri); + } + return matched; + })); endLastMatch = match.index + matched.length; } @@ -93,6 +77,7 @@ export class FilePathLinkifier implements IContributedLinkifier { } private async resolvePathText(pathText: string, context: LinkifierContext): Promise { + const includeDirectorySlash = pathText.endsWith('/'); const workspaceFolders = this.workspaceService.getWorkspaceFolders(); // Don't linkify very short paths such as '/' or special paths such as '../' @@ -102,7 +87,7 @@ export class FilePathLinkifier implements IContributedLinkifier { if (pathText.startsWith('/') || (isWindows && (pathText.startsWith('\\') || hasDriveLetter(pathText)))) { try { - const uri = await this.statAndNormalizeUri(Uri.file(pathText.startsWith('/') ? path.posix.normalize(pathText) : path.normalize(pathText))); + const uri = await this.statAndNormalizeUri(Uri.file(pathText.startsWith('/') ? path.posix.normalize(pathText) : path.normalize(pathText)), includeDirectorySlash); if (uri) { if (path.posix.normalize(uri.path) === '/') { return undefined; @@ -121,7 +106,7 @@ export class FilePathLinkifier implements IContributedLinkifier { try { const uri = Uri.parse(pathText); if (uri.scheme === Schemas.file || workspaceFolders.some(folder => folder.scheme === uri.scheme && folder.authority === uri.authority)) { - const statedUri = await this.statAndNormalizeUri(uri); + const statedUri = await this.statAndNormalizeUri(uri, includeDirectorySlash); if (statedUri) { return statedUri; } @@ -133,7 +118,7 @@ export class FilePathLinkifier implements IContributedLinkifier { } for (const workspaceFolder of workspaceFolders) { - const uri = await this.statAndNormalizeUri(Uri.joinPath(workspaceFolder, pathText)); + const uri = await this.statAndNormalizeUri(Uri.joinPath(workspaceFolder, pathText), includeDirectorySlash); if (uri) { return uri; } @@ -154,12 +139,18 @@ export class FilePathLinkifier implements IContributedLinkifier { return refUri; } - private async statAndNormalizeUri(uri: Uri): Promise { + private async statAndNormalizeUri(uri: Uri, includeDirectorySlash: boolean): Promise { try { const stat = await this.fileSystem.stat(uri); if (stat.type === FileType.Directory) { - // Ensure all dir paths have a trailing slash for icon rendering - return uri.path.endsWith('/') ? uri : uri.with({ path: `${uri.path}/` }); + if (includeDirectorySlash) { + return uri.path.endsWith('/') ? uri : uri.with({ path: `${uri.path}/` }); + } + + if (uri.path.endsWith('/') && uri.path !== '/') { + return uri.with({ path: uri.path.slice(0, -1) }); + } + return uri; } return uri; diff --git a/src/extension/linkify/common/linkifyService.ts b/src/extension/linkify/common/linkifyService.ts index dfaa18bc3f..55410ac642 100644 --- a/src/extension/linkify/common/linkifyService.ts +++ b/src/extension/linkify/common/linkifyService.ts @@ -13,6 +13,7 @@ import { PromptReference } from '../../prompt/common/conversation'; import { FilePathLinkifier } from './filePathLinkifier'; import { LinkifiedText } from './linkifiedText'; import { Linkifier } from './linkifier'; +import { ModelFilePathLinkifier } from './modelFilePathLinkifier'; /** * A stateful linkifier. @@ -86,6 +87,8 @@ export class LinkifyService implements ILinkifyService { @IWorkspaceService workspaceService: IWorkspaceService, @IEnvService private readonly envService: IEnvService, ) { + // Model-generated links first (anchors), fallback legacy path linkifier afterwards + this.registerGlobalLinkifier({ create: () => new ModelFilePathLinkifier(fileSystem, workspaceService) }); this.registerGlobalLinkifier({ create: () => new FilePathLinkifier(fileSystem, workspaceService) }); } diff --git a/src/extension/linkify/common/modelFilePathLinkifier.ts b/src/extension/linkify/common/modelFilePathLinkifier.ts new file mode 100644 index 0000000000..0a69db95c6 --- /dev/null +++ b/src/extension/linkify/common/modelFilePathLinkifier.ts @@ -0,0 +1,265 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IFileSystemService } from '../../../platform/filesystem/common/fileSystemService'; +import { FileType } from '../../../platform/filesystem/common/fileTypes'; +import { getWorkspaceFileDisplayPath, IWorkspaceService } from '../../../platform/workspace/common/workspaceService'; +import { CancellationToken } from '../../../util/vs/base/common/cancellation'; +import { normalizePath as normalizeUriPath } from '../../../util/vs/base/common/resources'; +import { Location, Position, Range, Uri } from '../../../vscodeTypes'; +import { coalesceParts, LinkifiedPart, LinkifiedText, LinkifyLocationAnchor } from './linkifiedText'; +import { IContributedLinkifier, LinkifierContext } from './linkifyService'; + +// Matches markdown links where the text is a path and optional #L anchor is present +// Example: [src/file.ts](src/file.ts#L10-12) or [src/file.ts](src/file.ts) +const modelLinkRe = /\[(?[^\]\n]+)\]\((?[^\s)]+)\)/gu; + +export class ModelFilePathLinkifier implements IContributedLinkifier { + constructor( + @IFileSystemService private readonly fileSystem: IFileSystemService, + @IWorkspaceService private readonly workspaceService: IWorkspaceService, + ) { } + + async linkify(text: string, context: LinkifierContext, token: CancellationToken): Promise { + let lastIndex = 0; + const parts: Array> = []; + const workspaceFolders = this.workspaceService.getWorkspaceFolders(); + + for (const match of text.matchAll(modelLinkRe)) { + const original = match[0]; + const prefix = text.slice(lastIndex, match.index); + if (prefix) { + parts.push(prefix); + } + lastIndex = match.index + original.length; + + const parsed = this.parseModelLinkMatch(match); + if (!parsed) { + parts.push(original); + continue; + } + + if (!this.canLinkify(parsed, workspaceFolders)) { + parts.push(original); + continue; + } + + // Push promise to resolve in parallel with other matches + // Pass originalTargetPath to preserve platform-specific separators (e.g., c:/path vs c:\path) before Uri.file() conversion + parts.push(this.resolveTarget(parsed.targetPath, parsed.originalTargetPath, workspaceFolders, parsed.preserveDirectorySlash, token).then(resolved => { + if (!resolved) { + return original; + } + + const basePath = getWorkspaceFileDisplayPath(this.workspaceService, resolved); + const anchorRange = this.parseAnchor(parsed.anchor); + if (parsed.anchor && !anchorRange) { + return original; + } + + if (anchorRange) { + const { range, startLine, endLine } = anchorRange; + const displayPath = endLine && startLine !== endLine + ? `${basePath}#L${startLine}-L${endLine}` + : `${basePath}#L${startLine}`; + return new LinkifyLocationAnchor(new Location(resolved, range), displayPath); + } + + return new LinkifyLocationAnchor(resolved, basePath); + })); + } + + const suffix = text.slice(lastIndex); + if (suffix) { + parts.push(suffix); + } + + if (!parts.length) { + return undefined; + } + + return { parts: coalesceParts(await Promise.all(parts)) }; + } + + private parseModelLinkMatch(match: RegExpMatchArray): { readonly text: string; readonly targetPath: string; readonly anchor: string | undefined; readonly preserveDirectorySlash: boolean; readonly originalTargetPath: string } | undefined { + const rawText = match.groups?.['text']; + const rawTarget = match.groups?.['target']; + if (!rawText || !rawTarget) { + return undefined; + } + + const hashIndex = rawTarget.indexOf('#'); + const baseTarget = hashIndex === -1 ? rawTarget : rawTarget.slice(0, hashIndex); + const anchor = hashIndex === -1 ? undefined : rawTarget.slice(hashIndex + 1); + + let decodedBase = baseTarget; + try { + decodedBase = decodeURIComponent(baseTarget); + } catch { + // noop + } + + const preserveDirectorySlash = decodedBase.endsWith('/') && decodedBase.length > 1; + const normalizedTarget = this.normalizeSlashes(decodedBase); + const normalizedText = this.normalizeLinkText(rawText); + return { text: normalizedText, targetPath: normalizedTarget, anchor, preserveDirectorySlash, originalTargetPath: decodedBase }; + } + + private normalizeSlashes(value: string): string { + // Collapse one or more backslashes into a single forward slash so mixed separators normalize consistently. + return value.replace(/\\+/g, '/'); + } + + private normalizeLinkText(rawText: string): string { + let text = this.normalizeSlashes(rawText); + // Remove a leading or trailing backtick that sometimes wraps the visible link label. + text = text.replace(/^`|`$/g, ''); + + // Look for a trailing #L anchor segment so it can be stripped before we compare names. + const anchorMatch = /^(.+?)(#L\d+(?:-\d+)?)$/.exec(text); + return anchorMatch ? anchorMatch[1] : text; + } + + private canLinkify(parsed: { readonly text: string; readonly targetPath: string; readonly anchor: string | undefined }, workspaceFolders: readonly Uri[]): boolean { + const { text, targetPath, anchor } = parsed; + const textMatchesBase = targetPath === text; + const textIsFilename = !text.includes('/') && targetPath.endsWith(`/${text}`); + const descriptiveWithAnchor = !!anchor; // Allow any descriptive text when anchor is present + + return Boolean(workspaceFolders.length) && (textMatchesBase || textIsFilename || descriptiveWithAnchor); + } + + private async resolveTarget(targetPath: string, originalTargetPath: string, workspaceFolders: readonly Uri[], preserveDirectorySlash: boolean, token: CancellationToken): Promise { + if (!workspaceFolders.length) { + return undefined; + } + + if (token.isCancellationRequested) { + return undefined; + } + + if (this.isAbsolutePath(targetPath)) { + // Choose URI construction strategy based on workspace folder schemes. + // For local (file:) workspaces we keep using Uri.file; for remote schemes we attempt + // to project the absolute path into the remote scheme preserving the folder URI's authority. + const normalizedAbs = targetPath.replace(/\\/g, '/'); + + for (const folderUri of workspaceFolders) { + if (token.isCancellationRequested) { + return undefined; + } + if (folderUri.scheme === 'file') { + // Use original path (before normalization) for Uri.file to preserve platform-specific separators + const absoluteFileUri = this.tryCreateFileUri(originalTargetPath); + if (!absoluteFileUri) { + continue; + } + if (this.isEqualOrParent(absoluteFileUri, folderUri)) { + const stat = await this.tryStat(absoluteFileUri, preserveDirectorySlash, token); + if (stat) { + return stat; + } + } + continue; + } + + // Remote / virtual workspace: attempt to map the absolute path into the same scheme. + // Only consider it if the folder path is a prefix of the absolute path to avoid + // generating unrelated URIs. + const folderPath = folderUri.path.replace(/\\/g, '/'); + const prefix = folderPath.endsWith('/') ? folderPath : folderPath + '/'; + if (normalizedAbs.startsWith(prefix)) { + const candidate = folderUri.with({ path: normalizedAbs }); + const stat = await this.tryStat(candidate, preserveDirectorySlash, token); + if (stat) { + return stat; + } + } + } + return undefined; + } + + const segments = targetPath.split('/').filter(Boolean); + for (const folderUri of workspaceFolders) { + const candidate = Uri.joinPath(folderUri, ...segments); + const stat = await this.tryStat(candidate, preserveDirectorySlash, token); + if (stat) { + return stat; + } + } + + return undefined; + } + + private tryCreateFileUri(path: string): Uri | undefined { + try { + return Uri.file(path); + } catch { + return undefined; + } + } + + + private isEqualOrParent(target: Uri, folder: Uri): boolean { + const targetPath = normalizeUriPath(target).path; + const folderPath = normalizeUriPath(folder).path; + return targetPath === folderPath || targetPath.startsWith(folderPath.endsWith('/') ? folderPath : `${folderPath}/`); + } + + private parseAnchor(anchor: string | undefined): { readonly range: Range; readonly startLine: string; readonly endLine: string | undefined } | undefined { + // Parse supported anchor formats: L123, L123-456, L123-L456 + if (!anchor) { + return undefined; + } + const match = /^L(\d+)(?:-L?(\d+))?$/.exec(anchor); + if (!match) { + return undefined; + } + + const startLine = match[1]; + const endLineRaw = match[2]; + const normalizedEndLine = endLineRaw === startLine ? undefined : endLineRaw; + const start = parseInt(startLine, 10) - 1; + const end = parseInt(normalizedEndLine ?? startLine, 10) - 1; + if (Number.isNaN(start) || Number.isNaN(end) || start < 0 || end < start) { + return undefined; + } + + return { + range: new Range(new Position(start, 0), new Position(end, 0)), + startLine, + endLine: normalizedEndLine, + }; + } + + private isAbsolutePath(path: string): boolean { + // Treat drive-letter prefixes (e.g. C:) or leading slashes as absolute paths. + return /^[a-z]:/i.test(path) || path.startsWith('/'); + } + + private async tryStat(uri: Uri, preserveDirectorySlash: boolean, token: CancellationToken): Promise { + if (token.isCancellationRequested) { + return undefined; + } + try { + const stat = await this.fileSystem.stat(uri); + if (stat.type === FileType.Directory) { + const isRoot = uri.path === '/'; + const hasTrailingSlash = uri.path.endsWith('/'); + const shouldHaveTrailingSlash = preserveDirectorySlash && !isRoot; + + if (shouldHaveTrailingSlash && !hasTrailingSlash) { + return uri.with({ path: `${uri.path}/` }); + } + if (!shouldHaveTrailingSlash && hasTrailingSlash) { + return uri.with({ path: uri.path.slice(0, -1) }); + } + } + return uri; + } catch { + return undefined; + } + } +} diff --git a/src/extension/linkify/test/node/modelFilePathLinkifier.spec.ts b/src/extension/linkify/test/node/modelFilePathLinkifier.spec.ts new file mode 100644 index 0000000000..7a468a1635 --- /dev/null +++ b/src/extension/linkify/test/node/modelFilePathLinkifier.spec.ts @@ -0,0 +1,197 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { expect, suite, test } from 'vitest'; +import { NullEnvService } from '../../../../platform/env/common/nullEnvService'; +import { IFileSystemService } from '../../../../platform/filesystem/common/fileSystemService'; +import { FileType } from '../../../../platform/filesystem/common/fileTypes'; +import { NullWorkspaceService } from '../../../../platform/workspace/common/workspaceService'; +import { CancellationToken } from '../../../../util/vs/base/common/cancellation'; +import { URI } from '../../../../util/vs/base/common/uri'; +import { Location, Position, Range } from '../../../../vscodeTypes'; +import { LinkifyLocationAnchor } from '../../common/linkifiedText'; +import { LinkifyService } from '../../common/linkifyService'; +import { ModelFilePathLinkifier } from '../../common/modelFilePathLinkifier'; +import { assertPartsEqual, createTestLinkifierService, linkify, workspaceFile } from './util'; + +suite('Model File Path Linkifier', () => { + test('Should linkify model generated file references with line range', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[src/file.ts](src/file.ts#L10-12)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(9, 0), new Position(11, 0)))); + expect(anchor.title).toBe('src/file.ts#L10-L12'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should linkify single line anchors', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[src/file.ts](src/file.ts#L5)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(4, 0), new Position(4, 0)))); + expect(anchor.title).toBe('src/file.ts#L5'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should linkify absolute file paths', async () => { + const absolutePath = workspaceFile('src/file.ts').fsPath; + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, `[src/file.ts](${absolutePath}#L2)`); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(1, 0), new Position(1, 0)))); + expect(anchor.title).toBe('src/file.ts#L2'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should decode percent-encoded targets', async () => { + const service = createTestLinkifierService('space file.ts'); + const result = await linkify(service, '[space file.ts](space%20file.ts#L1)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('space file.ts'), new Range(new Position(0, 0), new Position(0, 0)))); + assertPartsEqual([anchor], [expected]); + }); + + test('Should fallback when text does not match base path and no anchor', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[other](src/file.ts)'); + assertPartsEqual(result.parts, ['other']); + }); + + test('Should linkify descriptive text with anchor', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[Await chat view](src/file.ts#L54)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(53, 0), new Position(53, 0)))); + expect(anchor.title).toBe('src/file.ts#L54'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should fallback for invalid anchor syntax', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[src/file.ts](src/file.ts#Lines10-12)'); + assertPartsEqual(result.parts, ['src/file.ts']); + }); + + test('Should handle backticks in link text', async () => { + const service = createTestLinkifierService('file.ts'); + const result = await linkify(service, '[`file.ts`](file.ts)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(workspaceFile('file.ts')); + assertPartsEqual([anchor], [expected]); + }); + + test('Should handle backticks in link text with line anchor', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[`src/file.ts`](src/file.ts#L42)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(41, 0), new Position(41, 0)))); + expect(anchor.title).toBe('src/file.ts#L42'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should handle L123-L456 anchor format with L prefix on end line', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[src/file.ts](src/file.ts#L10-L15)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(9, 0), new Position(14, 0)))); + expect(anchor.title).toBe('src/file.ts#L10-L15'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should handle descriptive text with L123-L456 anchor format', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[Some descriptive text](src/file.ts#L20-L25)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(19, 0), new Position(24, 0)))); + expect(anchor.title).toBe('src/file.ts#L20-L25'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should normalize non-standard L123-456 format to standard L123-L456', async () => { + const service = createTestLinkifierService('src/file.ts'); + const result = await linkify(service, '[src/file.ts](src/file.ts#L20-25)'); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(19, 0), new Position(24, 0)))); + expect(anchor.title).toBe('src/file.ts#L20-L25'); + assertPartsEqual([anchor], [expected]); + }); + + test('Should handle absolute paths with forward slashes on Windows', async () => { + const absolutePath = workspaceFile('src/file.ts').fsPath; + const service = createTestLinkifierService('src/file.ts'); + // Simulate model-generated path with forward slashes (e.g., c:/Repos/...) + const pathWithForwardSlashes = absolutePath.replace(/\\/g, '/'); + const result = await linkify(service, `[line 67](${pathWithForwardSlashes}#L67)`); + const anchor = result.parts[0] as LinkifyLocationAnchor; + const expected = new LinkifyLocationAnchor(new Location(workspaceFile('src/file.ts'), new Range(new Position(66, 0), new Position(66, 0)))); + expect(anchor.title).toBe('src/file.ts#L67'); + assertPartsEqual([anchor], [expected]); + }); +}); + +suite('Model File Path Linkifier Remote Workspace', () => { + function createRemoteService(root: URI, files: readonly URI[]): LinkifyService { + class MockFs implements IFileSystemService { + readonly _serviceBrand: undefined; + async stat(resource: URI) { + if (resource.toString() === root.toString()) { + return { ctime: 0, mtime: 0, size: 0, type: FileType.Directory }; + } + const found = files.find(f => f.toString() === resource.toString()); + if (!found) { + throw new Error('File not found: ' + resource.toString()); + } + return { ctime: 0, mtime: 0, size: 0, type: found.path.endsWith('/') ? FileType.Directory : FileType.File }; + } + readDirectory(): Promise<[string, FileType][]> { throw new Error('Not implemented'); } + createDirectory(): Promise { throw new Error('Not implemented'); } + readFile(): Promise { throw new Error('Not implemented'); } + writeFile(): Promise { throw new Error('Not implemented'); } + delete(): Promise { throw new Error('Not implemented'); } + rename(): Promise { throw new Error('Not implemented'); } + copy(): Promise { throw new Error('Not implemented'); } + isWritableFileSystem(): boolean | undefined { return true; } + createFileSystemWatcher(): any { throw new Error('Not implemented'); } + } + const fs = new MockFs(); + const workspaceService = new NullWorkspaceService([root]); + const service = new LinkifyService(fs, workspaceService, NullEnvService.Instance); + service.registerGlobalLinkifier({ create: () => new ModelFilePathLinkifier(fs, workspaceService) }); + return service; + } + + async function remoteLinkify(service: LinkifyService, text: string) { + const linkifier = service.createLinkifier({ requestId: undefined, references: [] }, []); + const initial = await linkifier.append(text, CancellationToken.None); + const flushed = await linkifier.flush(CancellationToken.None); + return flushed ? [...initial.parts, ...flushed.parts] : initial.parts; + } + + const remoteRoot = URI.from({ scheme: 'test', authority: 'auth', path: '/home/user/project' }); + const remoteFile = URI.from({ scheme: 'test', authority: 'auth', path: '/home/user/project/src/remote.ts' }); + + test('Should map absolute remote path preserving scheme', async () => { + const service = createRemoteService(remoteRoot, [remoteFile]); + const parts = await remoteLinkify(service, '[/home/user/project/src/remote.ts](/home/user/project/src/remote.ts)'); + expect(parts.length).toBe(1); + const anchor = parts[0] as LinkifyLocationAnchor; + expect(anchor.value.toString()).toBe(remoteFile.toString()); + expect(anchor.title).toBe('src/remote.ts'); + }); + + test('Should parse line range anchor on remote absolute path', async () => { + const service = createRemoteService(remoteRoot, [remoteFile]); + const parts = await remoteLinkify(service, '[/home/user/project/src/remote.ts](/home/user/project/src/remote.ts#L3-5)'); + expect(parts.length).toBe(1); + const anchor = parts[0] as LinkifyLocationAnchor; + // Anchor value is a Location when an anchor is present. + const location = anchor.value as Location; + expect(location.uri.toString()).toBe(remoteFile.toString()); + const range = location.range; + expect(range.start.line).toBe(2); + expect(range.end.line).toBe(4); + expect(anchor.title).toBe('src/remote.ts#L3-L5'); + }); +}); diff --git a/src/extension/linkify/test/node/util.ts b/src/extension/linkify/test/node/util.ts index fd6950cfe9..2106252030 100644 --- a/src/extension/linkify/test/node/util.ts +++ b/src/extension/linkify/test/node/util.ts @@ -21,18 +21,19 @@ export function workspaceFile(path: string) { } export function createMockFsService(listOfFiles: readonly (string | URI)[]): IFileSystemService { - const workspaceFiles = listOfFiles.map(f => URI.isUri(f) ? f : workspaceFile(f)); + const workspaceEntries = listOfFiles.map(f => URI.isUri(f) ? f : workspaceFile(f)); return new class implements Partial { async stat(path: URI): Promise { if (path.path === '/' || path.path === workspace.path) { return { ctime: 0, mtime: 0, size: 0, type: FileType.File }; } - const entry = workspaceFiles.find(f => f.toString() === path.toString() || f.toString() === path.toString() + '/'); + const entry = workspaceEntries.find(f => f.toString() === path.toString() || f.toString() === `${path.toString()}/`); if (!entry) { throw new Error(`File not found: ${path}`); } - return { ctime: 0, mtime: 0, size: 0, type: FileType.File }; + const isDirectory = entry.path.endsWith('/'); + return { ctime: 0, mtime: 0, size: 0, type: isDirectory ? FileType.Directory : FileType.File }; } } as any; } @@ -42,6 +43,14 @@ export function createMockWorkspaceService(): IWorkspaceService { getWorkspaceFolders(): URI[] { return [workspace]; } + + getWorkspaceFolder(): URI | undefined { + return workspace; + } + + getWorkspaceFolderName(): string { + return 'workspace'; + } } as any; } diff --git a/src/extension/prompt/node/chatParticipantRequestHandler.ts b/src/extension/prompt/node/chatParticipantRequestHandler.ts index 3b1406baad..aaaca14764 100644 --- a/src/extension/prompt/node/chatParticipantRequestHandler.ts +++ b/src/extension/prompt/node/chatParticipantRequestHandler.ts @@ -447,10 +447,12 @@ function anchorPartToMarkdown(workspaceService: IWorkspaceService, anchor: ChatR if (URI.isUri(anchor.value)) { path = getWorkspaceFileDisplayPath(workspaceService, anchor.value); - text = `\`${path}\``; + const label = anchor.title ?? path; + text = `\`${label}\``; } else if (isLocation(anchor.value)) { path = getWorkspaceFileDisplayPath(workspaceService, anchor.value.uri); - text = `\`${path}\``; + const label = anchor.title ?? `${path}#L${anchor.value.range.start.line + 1}${anchor.value.range.start.line === anchor.value.range.end.line ? '' : `-${anchor.value.range.end.line + 1}`}`; + text = `\`${label}\``; } else if (isSymbolInformation(anchor.value)) { path = getWorkspaceFileDisplayPath(workspaceService, anchor.value.location.uri); text = `\`${anchor.value.name}\``; diff --git a/src/extension/prompts/node/agent/anthropicPrompts.tsx b/src/extension/prompts/node/agent/anthropicPrompts.tsx index b0571d138f..b9966d2769 100644 --- a/src/extension/prompts/node/agent/anthropicPrompts.tsx +++ b/src/extension/prompts/node/agent/anthropicPrompts.tsx @@ -12,6 +12,7 @@ import { Tag } from '../base/tag'; import { EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules'; import { MathIntegrationRules } from '../panel/editorIntegrationRules'; import { CodesearchModeInstructions, DefaultAgentPromptProps, detectToolCapabilities, GenericEditingTips, getEditingReminder, McpToolInstructions, NotebookInstructions, ReminderInstructionsProps } from './defaultAgentInstructions'; +import { FileLinkificationInstructions } from './fileLinkificationInstructions'; import { IAgentPrompt, PromptRegistry, ReminderInstructionsConstructor, SystemPrompt } from './promptRegistry'; class DefaultAnthropicAgentPrompt extends PromptElement { @@ -96,12 +97,8 @@ class DefaultAnthropicAgentPrompt extends PromptElement {this.props.availableTools && } - Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`.
- The function `calculateTotal` is defined in `lib/utils/math.ts`.
- You can find the configuration in `config/app.config.json`. -
+ Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section
+
@@ -192,12 +189,10 @@ class Claude45DefaultPrompt extends PromptElement { {this.props.availableTools && } - Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`.
- The function `calculateTotal` is defined in `lib/utils/math.ts`.
- You can find the configuration in `config/app.config.json`. -
+ Use proper Markdown formatting: + - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`
+ - When mentioning files or line numbers, always follow the rules in fileLinkification section below: +
diff --git a/src/extension/prompts/node/agent/fileLinkificationInstructions.tsx b/src/extension/prompts/node/agent/fileLinkificationInstructions.tsx new file mode 100644 index 0000000000..f8f6bfca07 --- /dev/null +++ b/src/extension/prompts/node/agent/fileLinkificationInstructions.tsx @@ -0,0 +1,50 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { PromptElement } from '@vscode/prompt-tsx'; +import { Tag } from '../base/tag'; + +export class FileLinkificationInstructions extends PromptElement<{}> { + render() { + return + When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers.
+ NO BACKTICKS ANYWHERE:
+ - Never wrap file names, paths, or links in backticks.
+ - Never use inline-code formatting for any file reference.
+
+ + REQUIRED FORMATS:
+ - File: [path/file.ts](path/file.ts)
+ - Line: [file.ts](file.ts#L10)
+ - Range: [file.ts](file.ts#L10-L12)
+
+ + PATH RULES:
+ - Without line numbers: Display text must match the target path.
+ - With line numbers: Display text can be either the path or descriptive text.
+ - Use '/' only; strip drive letters and external folders.
+ - Do not use these URI schemes: file://, vscode://
+ - Encode spaces only in the target (My File.md → My%20File.md).
+ - Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20.
+ - Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10
+
+ + USAGE EXAMPLES:
+ - With path as display: The handler is in [src/handler.ts](src/handler.ts#L10).
+ - With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup.
+ - Bullet list: [Init widget](src/widget.ts#L321)
+ - File only: See [src/config.ts](src/config.ts) for settings.
+
+ + FORBIDDEN (NEVER OUTPUT):
+ - Inline code: `file.ts`, `src/file.ts`, `L86`.
+ - Plain text file names: file.ts, chatService.ts.
+ - References without links when mentioning specific file locations.
+ - Specific line citations without links ("Line 86", "at line 86", "on line 25").
+ - Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20)
+
+
; + } +} diff --git a/src/extension/prompts/node/agent/geminiPrompts.tsx b/src/extension/prompts/node/agent/geminiPrompts.tsx index 3c97fffa6e..5c1f8ab5a4 100644 --- a/src/extension/prompts/node/agent/geminiPrompts.tsx +++ b/src/extension/prompts/node/agent/geminiPrompts.tsx @@ -12,6 +12,7 @@ import { Tag } from '../base/tag'; import { EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules'; import { MathIntegrationRules } from '../panel/editorIntegrationRules'; import { CodesearchModeInstructions, DefaultAgentPromptProps, detectToolCapabilities, GenericEditingTips, getEditingReminder, McpToolInstructions, NotebookInstructions, ReminderInstructionsProps } from './defaultAgentInstructions'; +import { FileLinkificationInstructions } from './fileLinkificationInstructions'; import { IAgentPrompt, PromptRegistry, ReminderInstructionsConstructor, SystemPrompt } from './promptRegistry'; /** @@ -99,12 +100,8 @@ export class DefaultGeminiAgentPrompt extends PromptElement} - Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`.
- The function `calculateTotal` is defined in `lib/utils/math.ts`.
- You can find the configuration in `config/app.config.json`. -
+ Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below
+
diff --git a/src/extension/prompts/node/agent/openai/defaultOpenAIPrompt.tsx b/src/extension/prompts/node/agent/openai/defaultOpenAIPrompt.tsx index cdf8b8959e..99a9b9251a 100644 --- a/src/extension/prompts/node/agent/openai/defaultOpenAIPrompt.tsx +++ b/src/extension/prompts/node/agent/openai/defaultOpenAIPrompt.tsx @@ -12,6 +12,7 @@ import { Tag } from '../../base/tag'; import { EXISTING_CODE_MARKER } from '../../panel/codeBlockFormattingRules'; import { MathIntegrationRules } from '../../panel/editorIntegrationRules'; import { ApplyPatchInstructions, CodesearchModeInstructions, DefaultAgentPromptProps, detectToolCapabilities, GenericEditingTips, getEditingReminder, McpToolInstructions, NotebookInstructions, ReminderInstructionsProps } from '../defaultAgentInstructions'; +import { FileLinkificationInstructions } from '../fileLinkificationInstructions'; import { IAgentPrompt, PromptRegistry, ReminderInstructionsConstructor, SystemPrompt } from '../promptRegistry'; export class DefaultOpenAIKeepGoingReminder extends PromptElement { @@ -107,12 +108,9 @@ export class DefaultOpenAIAgentPrompt extends PromptElement} - Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`.
- The function `calculateTotal` is defined in `lib/utils/math.ts`.
- You can find the configuration in `config/app.config.json`. -
+ - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`
+ - When mentioning files or line numbers, always follow the rules in fileLinkification section below: +
diff --git a/src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx b/src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx index aa674e86bf..b6ae8dc38b 100644 --- a/src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx +++ b/src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx @@ -12,6 +12,7 @@ import { Gpt5SafetyRule } from '../../base/safetyRules'; import { Tag } from '../../base/tag'; import { MathIntegrationRules } from '../../panel/editorIntegrationRules'; import { DefaultAgentPromptProps, detectToolCapabilities } from '../defaultAgentInstructions'; +import { FileLinkificationInstructions } from '../fileLinkificationInstructions'; import { CopilotIdentityRulesConstructor, IAgentPrompt, PromptRegistry, SafetyRulesConstructor, SystemPrompt } from '../promptRegistry'; /** @@ -71,7 +72,8 @@ class Gpt51CodexPrompt extends PromptElement { - Markdown text. Use structure only when it helps scanability.
- Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help.
- Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent.
- - Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **.
+ - Monospace: backticks for commands, env vars, and code identifiers; never combine with **.
+ - File path and line number formatting rules are defined in the fileLinkification section below.
- Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible.
- Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task.
- Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording.
@@ -79,10 +81,10 @@ class Gpt51CodexPrompt extends PromptElement { - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. - When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`. - + Use proper Markdown formatting: + - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`
+ - When mentioning files or line numbers, always follow the rules in fileLinkification section below: +
; diff --git a/src/extension/prompts/node/agent/openai/gpt51Prompt.tsx b/src/extension/prompts/node/agent/openai/gpt51Prompt.tsx index 082a380394..e1e18c3e87 100644 --- a/src/extension/prompts/node/agent/openai/gpt51Prompt.tsx +++ b/src/extension/prompts/node/agent/openai/gpt51Prompt.tsx @@ -14,6 +14,7 @@ import { Gpt5SafetyRule } from '../../base/safetyRules'; import { Tag } from '../../base/tag'; import { MathIntegrationRules } from '../../panel/editorIntegrationRules'; import { ApplyPatchInstructions, DefaultAgentPromptProps, detectToolCapabilities, getEditingReminder, McpToolInstructions, ReminderInstructionsProps } from '../defaultAgentInstructions'; +import { FileLinkificationInstructions } from '../fileLinkificationInstructions'; import { CopilotIdentityRulesConstructor, IAgentPrompt, PromptRegistry, ReminderInstructionsConstructor, SafetyRulesConstructor, SystemPrompt } from '../promptRegistry'; class Gpt51Prompt extends PromptElement { @@ -221,9 +222,10 @@ class Gpt51Prompt extends PromptElement {
**Monospace**

- - Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``).
+ - Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``).
- Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command.
- - Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``).
+ - Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`).
+ - File path and line number formatting rules are defined in the fileLinkification section below.

**Structure**

@@ -260,6 +262,7 @@ class Gpt51Prompt extends PromptElement { Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.

For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. + ; diff --git a/src/extension/prompts/node/agent/openai/gpt5CodexPrompt.tsx b/src/extension/prompts/node/agent/openai/gpt5CodexPrompt.tsx index 060ab05baf..14e98b476d 100644 --- a/src/extension/prompts/node/agent/openai/gpt5CodexPrompt.tsx +++ b/src/extension/prompts/node/agent/openai/gpt5CodexPrompt.tsx @@ -8,6 +8,7 @@ import { IChatEndpoint } from '../../../../../platform/networking/common/network import { ToolName } from '../../../../tools/common/toolNames'; import { InstructionMessage } from '../../base/instructionMessage'; import { DefaultAgentPromptProps, detectToolCapabilities } from '../defaultAgentInstructions'; +import { FileLinkificationInstructions } from '../fileLinkificationInstructions'; import { IAgentPrompt, PromptRegistry, SystemPrompt } from '../promptRegistry'; class CodexStyleGpt5CodexPrompt extends PromptElement { @@ -69,18 +70,13 @@ class CodexStyleGpt5CodexPrompt extends PromptElement { - Markdown text. Use structure only when it helps scanability.
- Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help.
- Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent.
- - Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **.
+ - Monospace: backticks for commands, env vars, and code identifiers; never combine with **.
- Code samples or multi-line snippets should be wrapped in fenced code blocks; add a language hint whenever obvious.
- Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task.
- Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording.
- Don'ts: no nested bullets/hierarchies; no ANSI codes; don't cram unrelated keywords; keep keyword lists short—wrap/reformat if long; avoid naming formatting styles in answers.
- Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets.
- - File References: When referencing files in your response, always follow the below rules:
- * Use inline code to make file paths clickable.
- * Each reference should have a stand alone path. Even if it's the same file.
- * Accepted: absolute, workspace-relative, a/ or b/ diff prefixes, or bare filename/suffix.
- * Do not use URIs like file://, vscode://, or https://.
- * Examples: src/app.ts, C:\repo\project\main.rs
+ ; } } diff --git a/src/extension/prompts/node/agent/openai/gpt5Prompt.tsx b/src/extension/prompts/node/agent/openai/gpt5Prompt.tsx index 05226cc611..4cb225784b 100644 --- a/src/extension/prompts/node/agent/openai/gpt5Prompt.tsx +++ b/src/extension/prompts/node/agent/openai/gpt5Prompt.tsx @@ -14,6 +14,7 @@ import { Gpt5SafetyRule } from '../../base/safetyRules'; import { Tag } from '../../base/tag'; import { MathIntegrationRules } from '../../panel/editorIntegrationRules'; import { ApplyPatchInstructions, DefaultAgentPromptProps, detectToolCapabilities, McpToolInstructions, ReminderInstructionsProps, ToolReferencesHintProps } from '../defaultAgentInstructions'; +import { FileLinkificationInstructions } from '../fileLinkificationInstructions'; import { CopilotIdentityRulesConstructor, IAgentPrompt, PromptRegistry, ReminderInstructionsConstructor, SafetyRulesConstructor, SystemPrompt, ToolReferencesHintConstructor } from '../promptRegistry'; import { Gpt51ReminderInstructions } from './gpt51Prompt'; @@ -186,9 +187,10 @@ class DefaultGpt5AgentPrompt extends PromptElement { - Use consistent keyword phrasing and formatting across sections.

Monospace:
- - Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``).
+ - Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``).
- Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command.
- - Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``).
+ - Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`).
+ - File path and line number formatting rules are defined in the fileLinkification section below.

Structure:
- Place related bullets together; don't mix unrelated concepts in the same section.
@@ -216,13 +218,13 @@ class DefaultGpt5AgentPrompt extends PromptElement {
For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.

- When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`. - + - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`
+ - When mentioning files or line numbers, always follow the rules in fileLinkification section below: + + ; } } diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-arctic-fox.spec.snap index 94325df1bd..ad26653f3c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-opus-4.5.spec.snap index 574bbf5531..6030b8f8f2 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-opus-4.5.spec.snap @@ -43,12 +43,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed
-Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-sonnet-4.5.spec.snap index 70b4100628..0c76541aa1 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-sonnet-4.5.spec.snap @@ -74,12 +74,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed
-Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gemini-2.0-flash.spec.snap index 655e5bcdea..17d607ff7a 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gemini-2.0-flash.spec.snap @@ -43,12 +43,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed
-Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-4.1.spec.snap index 8d32f34608..504b022813 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-4.1.spec.snap @@ -45,12 +45,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed
-Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex-mini.spec.snap index 94325df1bd..ad26653f3c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex.spec.snap index 94325df1bd..ad26653f3c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1.spec.snap index cc85a36bdd..7b57c21406 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.spec.snap index e0656a44b4..80142f6756 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-grok-code-fast-1.spec.snap index 4a1c00c45f..7b51f397e9 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-grok-code-fast-1.spec.snap @@ -50,12 +50,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-arctic-fox.spec.snap index e8d2e765bf..356cf75c11 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-opus-4.5.spec.snap index cad2f991cb..09a3bf4084 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-opus-4.5.spec.snap @@ -45,12 +45,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-sonnet-4.5.spec.snap index 677dfcbe7e..5a34ce8892 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-claude-sonnet-4.5.spec.snap @@ -75,12 +75,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gemini-2.0-flash.spec.snap index da269da3a4..147e265dfe 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gemini-2.0-flash.spec.snap @@ -45,12 +45,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-4.1.spec.snap index b63e3af0d5..51dc7a9017 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-4.1.spec.snap @@ -81,12 +81,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex-mini.spec.snap index e8d2e765bf..356cf75c11 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex.spec.snap index e8d2e765bf..356cf75c11 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1.spec.snap index d6f1808259..00556d9472 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.1.spec.snap @@ -230,9 +230,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -268,7 +269,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.spec.snap index 690ec7e334..fa2ad013a4 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-gpt-5.spec.snap @@ -204,9 +204,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -234,10 +235,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-grok-code-fast-1.spec.snap index 19c05fa248..b21fe5e352 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_tools-grok-code-fast-1.spec.snap @@ -52,12 +52,42 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce Important Reminder: Markdown cells cannot be executed -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-arctic-fox.spec.snap index 2c228b4ca4..61f5b5897b 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-opus-4.5.spec.snap index 4ec7629e69..3cf6b805bd 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-opus-4.5.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-sonnet-4.5.spec.snap index d5c9cee984..bfeabb1360 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-claude-sonnet-4.5.spec.snap @@ -62,12 +62,42 @@ Do NOT use emojis unless explicitly requested by the user. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gemini-2.0-flash.spec.snap index a78efb1ab8..5c8585e066 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gemini-2.0-flash.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-4.1.spec.snap index cd886bb49c..2a86517443 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-4.1.spec.snap @@ -34,12 +34,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex-mini.spec.snap index 2c228b4ca4..61f5b5897b 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex.spec.snap index 2c228b4ca4..61f5b5897b 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1.spec.snap index fe5116bd1b..3eec1f4e13 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.spec.snap index 8338dc6ec5..76b978fd06 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-grok-code-fast-1.spec.snap index 8596b3e4f7..c0810ac9ce 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs-grok-code-fast-1.spec.snap @@ -39,12 +39,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-arctic-fox.spec.snap index 93561efc31..852dc2aed8 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-opus-4.5.spec.snap index b7dbb91c9d..6025817217 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-opus-4.5.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-sonnet-4.5.spec.snap index 2b5882ecd8..f506e4a01e 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-claude-sonnet-4.5.spec.snap @@ -62,12 +62,42 @@ Do NOT use emojis unless explicitly requested by the user. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gemini-2.0-flash.spec.snap index 0c04f7e4cf..8888f6b8cd 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gemini-2.0-flash.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-4.1.spec.snap index 3c05b2bc37..228013a417 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-4.1.spec.snap @@ -34,12 +34,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex-mini.spec.snap index 93561efc31..852dc2aed8 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex.spec.snap index 93561efc31..852dc2aed8 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1.spec.snap index d58fede5fe..a53717341c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.spec.snap index 697d75b130..bc4dff0516 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-grok-code-fast-1.spec.snap index a198c09a07..a1884362f8 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-cache_BPs_multi_round-grok-code-fast-1.spec.snap @@ -39,12 +39,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-arctic-fox.spec.snap index b64d0ae9d9..487e376bf6 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-opus-4.5.spec.snap index 7ed42f9d69..0ff84618ba 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-opus-4.5.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-sonnet-4.5.spec.snap index e2854c1d5a..c767e552da 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-claude-sonnet-4.5.spec.snap @@ -62,12 +62,42 @@ Do NOT use emojis unless explicitly requested by the user. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gemini-2.0-flash.spec.snap index 3b3c5901b0..b82e96ed20 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gemini-2.0-flash.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-4.1.spec.snap index 1122fce6a1..afc1fba700 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-4.1.spec.snap @@ -34,12 +34,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex-mini.spec.snap index b64d0ae9d9..487e376bf6 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex.spec.snap index b64d0ae9d9..487e376bf6 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1.spec.snap index 1cd60ccbb0..ec01198136 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.spec.snap index d4ac4fb9f2..d8f6f36651 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-grok-code-fast-1.spec.snap index 6ec32c59da..e7251712cd 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-custom_instructions_not_in_system_message-grok-code-fast-1.spec.snap @@ -39,12 +39,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-arctic-fox.spec.snap index 2501dd8e21..f8f284fb0f 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-opus-4.5.spec.snap index 6ab2c80146..059b63117a 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-opus-4.5.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-sonnet-4.5.spec.snap index 658e151596..7131ec62c0 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-claude-sonnet-4.5.spec.snap @@ -62,12 +62,42 @@ Do NOT use emojis unless explicitly requested by the user. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gemini-2.0-flash.spec.snap index c2e74a3615..ea0d9547d6 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gemini-2.0-flash.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-4.1.spec.snap index da9cabbbbb..b8884331b1 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-4.1.spec.snap @@ -34,12 +34,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex-mini.spec.snap index 2501dd8e21..f8f284fb0f 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex.spec.snap index 2501dd8e21..f8f284fb0f 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1.spec.snap index 1a8c5ca331..59b95e2df0 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.spec.snap index 878d9c6ac4..63e85f1d8d 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-grok-code-fast-1.spec.snap index 5b37e1931a..8e7dc5e39a 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-one_attachment-grok-code-fast-1.spec.snap @@ -39,12 +39,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-arctic-fox.spec.snap index 94325df1bd..ad26653f3c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-opus-4.5.spec.snap index cac85bd5ec..f1319bc347 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-opus-4.5.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-sonnet-4.5.spec.snap index a31e7b0aae..fb3f1eea24 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-claude-sonnet-4.5.spec.snap @@ -62,12 +62,42 @@ Do NOT use emojis unless explicitly requested by the user. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gemini-2.0-flash.spec.snap index f1af247874..adac85b479 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gemini-2.0-flash.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-4.1.spec.snap index 1244d6fd64..370faa6458 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-4.1.spec.snap @@ -34,12 +34,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex-mini.spec.snap index 94325df1bd..ad26653f3c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex.spec.snap index 94325df1bd..ad26653f3c 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1.spec.snap index cc85a36bdd..7b57c21406 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.spec.snap index e0656a44b4..80142f6756 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-grok-code-fast-1.spec.snap index da93b9b0ca..0f407aa8a7 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-simple_case-grok-code-fast-1.spec.snap @@ -39,12 +39,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-arctic-fox.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-arctic-fox.spec.snap index b5ef16d4d2..52149a5642 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-arctic-fox.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-arctic-fox.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-opus-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-opus-4.5.spec.snap index 527ec5edf2..9ee564ced4 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-opus-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-opus-4.5.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-sonnet-4.5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-sonnet-4.5.spec.snap index 847b811727..ba8d44f14b 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-sonnet-4.5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-claude-sonnet-4.5.spec.snap @@ -62,12 +62,42 @@ Do NOT use emojis unless explicitly requested by the user. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gemini-2.0-flash.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gemini-2.0-flash.spec.snap index e45a9d08a9..452ad19480 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gemini-2.0-flash.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gemini-2.0-flash.spec.snap @@ -32,12 +32,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-4.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-4.1.spec.snap index 8e4fda165f..83ff2646f3 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-4.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-4.1.spec.snap @@ -34,12 +34,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex-mini.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex-mini.spec.snap index b5ef16d4d2..52149a5642 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex-mini.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex-mini.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex.spec.snap index b5ef16d4d2..52149a5642 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1-codex.spec.snap @@ -47,7 +47,8 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Markdown text. Use structure only when it helps scanability. - Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help. - Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. -- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Monospace: backticks for commands, env vars, and code identifiers; never combine with **. +- File path and line number formatting rules are defined in the fileLinkification section below. - Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. - Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. - Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. @@ -55,10 +56,42 @@ You are producing text that will be rendered as markdown by the VS Code UI. Foll - Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1.spec.snap index 39b40cef78..c172e17598 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.1.spec.snap @@ -195,9 +195,10 @@ You are producing plain text that will later be styled by the CLI. Follow these **Monospace** -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. **Structure** @@ -233,7 +234,42 @@ You are producing plain text that will later be styled by the CLI. Follow these Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable. -For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.spec.snap index 017a011231..7f3814984a 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-gpt-5.spec.snap @@ -168,9 +168,10 @@ Bullets: - Use consistent keyword phrasing and formatting across sections. Monospace: -- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``). +- Wrap all commands, env vars, and code identifiers in backticks (`` `...` ``). - Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command. -- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`) or inline code/path (`` ` ``). +- Never mix monospace and bold markers; choose one based on whether it's a keyword (`**`). +- File path and line number formatting rules are defined in the fileLinkification section below. Structure: - Place related bullets together; don't mix unrelated concepts in the same section. @@ -198,10 +199,42 @@ Generally, ensure your final answers adapt their shape and depth to the request. For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting. -When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. - +- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()` +- When mentioning files or line numbers, always follow the rules in fileLinkification section below: +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-grok-code-fast-1.spec.snap b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-grok-code-fast-1.spec.snap index 906c460648..9aa06131f2 100644 --- a/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-grok-code-fast-1.spec.snap +++ b/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-tool_use-grok-code-fast-1.spec.snap @@ -39,12 +39,42 @@ You don't currently have any tools available for running terminal commands. If t Tools can be disabled by the user. You may see tools used previously in the conversation that are not currently available. Be careful to only use the tools that are currently available to you. -Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks. - -The class `Person` is in `src/models/person.ts`. -The function `calculateTotal` is defined in `lib/utils/math.ts`. -You can find the configuration in `config/app.config.json`. - +Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below + +When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers. +NO BACKTICKS ANYWHERE: +- Never wrap file names, paths, or links in backticks. +- Never use inline-code formatting for any file reference. + +REQUIRED FORMATS: +- File: [path/file.ts](path/file.ts) +- Line: [file.ts](file.ts#L10) +- Range: [file.ts](file.ts#L10-L12) + +PATH RULES: +- Without line numbers: Display text must match the target path. +- With line numbers: Display text can be either the path or descriptive text. +- Use '/' only; strip drive letters and external folders. +- Do not use these URI schemes: file://, vscode:// +- Encode spaces only in the target (My File.md → My%20File.md). +- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20. +- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10 + +USAGE EXAMPLES: +- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10). +- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup. +- Bullet list: [Init widget](src/widget.ts#L321) +- File only: See [src/config.ts](src/config.ts) for settings. + +FORBIDDEN (NEVER OUTPUT): +- Inline code: `file.ts`, `src/file.ts`, `L86`. +- Plain text file names: file.ts, chatService.ts. +- References without links when mentioning specific file locations. +- Specific line citations without links ("Line 86", "at line 86", "on line 25"). +- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20) + + + diff --git a/src/extension/prompts/node/agent/vscModelPrompts.tsx b/src/extension/prompts/node/agent/vscModelPrompts.tsx index cd8f4b84d5..6f4c819bde 100644 --- a/src/extension/prompts/node/agent/vscModelPrompts.tsx +++ b/src/extension/prompts/node/agent/vscModelPrompts.tsx @@ -12,6 +12,7 @@ import { ResponseTranslationRules } from '../base/responseTranslationRules'; import { Tag } from '../base/tag'; import { MathIntegrationRules } from '../panel/editorIntegrationRules'; import { ApplyPatchInstructions, DefaultAgentPromptProps, detectToolCapabilities, GenericEditingTips, getEditingReminder, McpToolInstructions, NotebookInstructions, ReminderInstructionsProps } from './defaultAgentInstructions'; +import { FileLinkificationInstructions } from './fileLinkificationInstructions'; import { IAgentPrompt, PromptRegistry, ReminderInstructionsConstructor, SystemPrompt } from './promptRegistry'; class VSCModelPromptA extends PromptElement { @@ -330,6 +331,7 @@ class VSCModelPromptB extends PromptElement { Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks.
+ {tools[ToolName.CoreRunInTerminal] ? <> When commands are required, run them yourself in a terminal and summarize the results. Do not print runnable commands unless the user asks. If you must show them for documentation, make them clearly optional and keep one command per line.
: <> diff --git a/src/extension/prompts/node/agent/xAIPrompts.tsx b/src/extension/prompts/node/agent/xAIPrompts.tsx index 26267b9080..6bbd9f5d72 100644 --- a/src/extension/prompts/node/agent/xAIPrompts.tsx +++ b/src/extension/prompts/node/agent/xAIPrompts.tsx @@ -12,6 +12,7 @@ import { Tag } from '../base/tag'; import { EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules'; import { MathIntegrationRules } from '../panel/editorIntegrationRules'; import { CodesearchModeInstructions, DefaultAgentPromptProps, detectToolCapabilities, GenericEditingTips, McpToolInstructions, NotebookInstructions } from './defaultAgentInstructions'; +import { FileLinkificationInstructions } from './fileLinkificationInstructions'; import { IAgentPrompt, PromptRegistry, SystemPrompt } from './promptRegistry'; class DefaultGrokCodeFastAgentPrompt extends PromptElement { @@ -103,12 +104,8 @@ class DefaultGrokCodeFastAgentPrompt extends PromptElement} - Use proper Markdown formatting in your answers. When referring to a filename or symbol in the user's workspace, wrap it in backticks.
- - The class `Person` is in `src/models/person.ts`.
- The function `calculateTotal` is defined in `lib/utils/math.ts`.
- You can find the configuration in `config/app.config.json`. -
+ Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below
+
diff --git a/src/platform/endpoint/common/capiClient.ts b/src/platform/endpoint/common/capiClient.ts index c86117958e..f5732f2fb6 100644 --- a/src/platform/endpoint/common/capiClient.ts +++ b/src/platform/endpoint/common/capiClient.ts @@ -35,4 +35,4 @@ export abstract class BaseCAPIClientService extends CAPIClient implements ICAPIC }, LICENSE_AGREEMENT, fetcherService, hmac, integrationId); } } -export const ICAPIClientService = createServiceIdentifier('ICAPIClientService'); +export const ICAPIClientService = createServiceIdentifier('ICAPIClientService'); \ No newline at end of file