annotations.ts ×10

Frontier kind: Code frontier

unlabeled · c_2f7fd4102553

33 tests · 41292 LOC · 177 files · introduces 0 tests · 53 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges53 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3568 ranges41292 lines · 177 files · Browse complete extent
All tests (intent)
33 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 53 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/widget/annotations.ts 53 introduced LOC · 10 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- annotations.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 > import { MarkdownString } from '../../../../../base/common/htmlContent.js';
6 > import { basename } from '../../../../../base/common/resources.js';
7 > import { URI } from '../../../../../base/common/uri.js';
8 > import { IRange } from '../../../../../editor/common/core/range.js';
9 > import { isLocation } from '../../../../../editor/common/languages.js';
10 > import { IChatProgressRenderableResponseContent, IChatProgressResponseContent, appendMarkdownString, canMergeMarkdownStrings } from '../model/chatModel.js';
11 > import { IChatAgentVulnerabilityDetails } from '../chatService/chatService.js';
12 >
13 > export const contentRefUrl = 'http://_vscodecontentref_'; // must be lowercase for URI
14 >
15 > export function annotateSpecialMarkdownContent(response: Iterable<IChatProgressResponseContent>): IChatProgressRenderableResponseContent[] {
16 let refIdPool = 0;
17
104 return result;
105 }
107 > const contentRefPattern = new RegExp(`^(\\[.*?\\]\\(${contentRefUrl}/\\d+\\))+$`);
108 >
109 > /**
110 > * Returns true when the text consists entirely of synthesized content-ref
111 > * links (e.g. `[file.ts](http://_vscodecontentref_/0)`), with no other
112 > * markdown text mixed in. Used to decide whether the MarkdownString
113 > * properties are "synthetic defaults" that can safely be replaced.
114 > */
115 function isContentRefOnly(text: string): boolean {
116 return contentRefPattern.test(text);
117 }
119 > /**
120 > * Checks whether the end of a markdown string is inside a code context
121 > * (fenced code block or inline code span) where markdown link syntax
122 > * would be rendered as literal text.
123 > */
124 > export function isInsideCodeContext(text: string): boolean {
125 const lines = text.split('\n');
126 let inFencedBlock = false;
161 return inFencedBlock || hasUnclosedInlineCode(unfencedLines.join('\n'));
162 }
164 function countLeadingChar(text: string, char: string): number {
165 let count = 0;
169 return count;
170 }
172 > /**
173 > * Checks whether the text has an unclosed inline code span.
174 > * In CommonMark, a code span opens with a backtick sequence of length N
175 > * and closes with the next backtick sequence of the same length N.
176 > */
177 function hasUnclosedInlineCode(text: string): boolean {
178 let i = 0;
208 return false;
209 }
211 > export interface IMarkdownVulnerability {
212 > readonly title: string;
213 > readonly description: string;
214 > readonly range: IRange;
215 > }
216 > export function extractCodeblockUrisFromText(text: string): { uri: URI; isEdit?: boolean; subAgentInvocationId?: string; textWithoutResult: string } | undefined {
217 const match = /<vscode_codeblock_uri( isEdit)?( subAgentInvocationId="([^"]*)")?>([\s\S]*?)<\/vscode_codeblock_uri>/ms.exec(text);
218 if (match) {
239 return undefined;
240 }
242 > export function extractSubAgentInvocationIdFromText(text: string): string | undefined {
243 const match = /<vscode_codeblock_uri[^>]* subAgentInvocationId="([^"]*)"/ms.exec(text);
244 if (match) {
251 return undefined;
252 }
254 > export function hasCodeblockUriTag(text: string): boolean {
255 return text.includes('<vscode_codeblock_uri');
256 }
258 > export function hasEditCodeblockUriTag(text: string): boolean {
259 return text.includes('<vscode_codeblock_uri isEdit');
260 }
262 > export function extractVulnerabilitiesFromText(text: string): { newText: string; vulnerabilities: IMarkdownVulnerability[] } {
263 const vulnerabilities: IMarkdownVulnerability[] = [];
264 let newText = text;