config.ts ×6

Frontier kind: Code frontier

unlabeled · c_42efcf071aaf

381 tests · 7578 LOC · 36 files · introduces 0 tests · 180 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges180 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
852 ranges7578 lines · 36 files · Browse complete extent
All tests (intent)
381 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: 180 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/promptSyntax/config/config.ts 180 introduced LOC · 6 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- config.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 >
6 > import type { IConfigurationService } from '../../../../../../platform/configuration/common/configuration.js';
7 > import { URI } from '../../../../../../base/common/uri.js';
8 > import { PromptFileSource, PromptsType } from '../promptTypes.js';
9 > import { getPromptFileDefaultLocations, IPromptSourceFolder } from './promptFileLocations.js';
10 > import { PromptsStorage } from '../service/promptsService.js';
11 >
12 > /**
13 > * Configuration helper for the `reusable prompts` feature.
14 > * @see {@link PromptsConfig.PROMPT_LOCATIONS_KEY}, {@link PromptsConfig.INSTRUCTIONS_LOCATION_KEY}, {@link PromptsConfig.MODE_LOCATION_KEY}, or {@link PromptsConfig.PROMPT_FILES_SUGGEST_KEY}.
15 > *
16 > * ### Functions
17 > *
18 > * - {@link getLocationsValue} allows to current read configuration value
19 > * - {@link promptSourceFolders} gets list of source folders for prompt files
20 > * - {@link getPromptFilesRecommendationsValue} gets prompt file recommendation configuration
21 > *
22 > * ### File Paths Resolution
23 > *
24 > * We resolve only `*.prompt.md` files inside the resulting source folders. Relative paths are resolved
25 > * relative to:
26 > *
27 > * - the current workspace `root`, if applicable, in other words one of the workspace folders
28 > * can be used as a prompt files source folder
29 > * - root of each top-level folder in the workspace (if there are multiple workspace folders)
30 > * - current root folder (if a single folder is open)
31 > *
32 > * ### Prompt File Suggestions
33 > *
34 > * The `chat.promptFilesRecommendations` setting allows configuring which prompt files to suggest in different contexts:
35 > *
36 > * ```json
37 > * {
38 > * "chat.promptFilesRecommendations": {
39 > * "plan": true, // Always suggest
40 > * "new-page": "resourceExtname == .js", // Suggest for JavaScript files
41 > * "draft-blog": "resourceLangId == markdown", // Suggest for Markdown files
42 > * "debug": false // Never suggest
43 > * }
44 > * }
45 > * ```
46 > */
47 > export namespace PromptsConfig {
48 > /**
49 > * Configuration key for the locations of reusable prompt files.
50 > */
51 > export const PROMPT_LOCATIONS_KEY = 'chat.promptFilesLocations';
52 >
53 > /**
54 > * Configuration key for the locations of instructions files.
55 > */
56 > export const INSTRUCTIONS_LOCATION_KEY = 'chat.instructionsFilesLocations';
57 > /**
58 > * Configuration key for the locations of mode files.
59 > * @deprecated Use {@link AGENTS_LOCATION_KEY} instead
60 > */
61 > export const MODE_LOCATION_KEY = 'chat.modeFilesLocations';
62 >
63 > /**
64 > * Configuration key for the locations of agent files (with simplified path support).
65 > */
66 > export const AGENTS_LOCATION_KEY = 'chat.agentFilesLocations';
67 >
68 > /**
69 > * Configuration key for the locations of skill folders.
70 > */
71 > export const SKILLS_LOCATION_KEY = 'chat.agentSkillsLocations';
72 >
73 > /**
74 > * Configuration key for the locations of hook files.
75 > */
76 > export const HOOKS_LOCATION_KEY = 'chat.hookFilesLocations';
77 >
78 > /**
79 > * Configuration key for prompt file suggestions.
80 > */
81 > export const PROMPT_FILES_SUGGEST_KEY = 'chat.promptFilesRecommendations';
82 >
83 > /**
84 > * Configuration key for use of the copilot instructions file.
85 > */
86 > export const USE_COPILOT_INSTRUCTION_FILES = 'github.copilot.chat.codeGeneration.useInstructionFiles';
87 >
88 > /**
89 > * Configuration key for the AGENTS.md.
90 > */
91 > export const USE_AGENT_MD = 'chat.useAgentsMdFile';
92 >
93 > /**
94 > * Configuration key for nested AGENTS.md files.
95 > */
96 > export const USE_NESTED_AGENT_MD = 'chat.useNestedAgentsMdFiles';
97 >
98 > /**
99 > * Configuration key for the CLAUDE.md.
100 > */
101 > export const USE_CLAUDE_MD = 'chat.useClaudeMdFile';
102 >
103 > /**
104 > * Configuration key for agent skills usage.
105 > */
106 > export const USE_AGENT_SKILLS = 'chat.useAgentSkills';
107 >
108 > /**
109 > * Configuration key for chat hooks usage.
110 > */
111 > export const USE_CHAT_HOOKS = 'chat.useHooks';
112 >
113 > /**
114 > * Configuration key for enabling Claude hooks.
115 > */
116 > export const USE_CLAUDE_HOOKS = 'chat.useClaudeHooks';
117 >
118 > /**
119 > * Configuration key for enabling stronger skill adherence prompt (experimental).
120 > */
121 > export const USE_SKILL_ADHERENCE_PROMPT = 'chat.experimental.useSkillAdherencePrompt';
122 >
123 > /**
124 > * Configuration key for including applying instructions.
125 > */
126 > export const INCLUDE_APPLYING_INSTRUCTIONS = 'chat.includeApplyingInstructions';
127 >
128 > /**
129 > * Configuration key for including referenced instructions.
130 > */
131 > export const INCLUDE_REFERENCED_INSTRUCTIONS = 'chat.includeReferencedInstructions';
132 >
133 > /**
134 > * Search for configuration files in parent repositories of the workspace folder
135 > */
136 > export const USE_CUSTOMIZATIONS_IN_PARENT_REPOS = 'chat.useCustomizationsInParentRepositories';
137 >
138 > /**
139 > * Get value of the `reusable prompt locations` configuration setting.
140 > * @see {@link PROMPT_LOCATIONS_CONFIG_KEY}, {@link INSTRUCTIONS_LOCATIONS_CONFIG_KEY}, {@link MODE_LOCATIONS_CONFIG_KEY}, {@link SKILLS_LOCATION_KEY}.
141 > */
142 > export function getLocationsValue(configService: IConfigurationService, type: PromptsType): Record<string, boolean> | undefined {
143 const key = getPromptFileLocationsConfigKey(type);
144 const configValue = configService.getValue(key);
169 return undefined;
170 }
171 > config.ts
172 > /**
173 > * Gets list of source folders for prompt files.
174 > * Defaults to {@link PROMPT_DEFAULT_SOURCE_FOLDER}, {@link INSTRUCTIONS_DEFAULT_SOURCE_FOLDER}, {@link MODE_DEFAULT_SOURCE_FOLDER} or {@link SKILLS_LOCATION_KEY}.
175 > */
176 > export function promptSourceFolders(configService: IConfigurationService, type: PromptsType): IPromptSourceFolder[] {
177 const value = getLocationsValue(configService, type);
178 const defaultSourceFolders = getPromptFileDefaultLocations(type);
208 return [];
209 }
210 > config.ts
211 > /**
212 > * Get value of the prompt file recommendations configuration setting.
213 > * @param configService Configuration service instance
214 > * @param resource Optional resource URI to get workspace folder-specific settings
215 > * @see {@link PROMPT_FILES_SUGGEST_KEY}.
216 > */
217 > export function getPromptFilesRecommendationsValue(configService: IConfigurationService, resource?: URI): Record<string, boolean | string> | undefined {
218 // Get the merged configuration value (VS Code automatically merges all levels: default → user → workspace → folder)
219 const configValue = configService.getValue(PromptsConfig.PROMPT_FILES_SUGGEST_KEY, { resource });
258 return Object.keys(suggestions).length > 0 ? suggestions : undefined;
259 }
260 > config.ts
261 > }
262 >
263 > export function getPromptFileLocationsConfigKey(type: PromptsType): string {
264 switch (type) {
265 case PromptsType.instructions:
277 }
278 }
279 > config.ts
280 > /**
281 > * Helper to parse an input value of `any` type into a boolean.
282 > *
283 > * @param value - input value to parse
284 > * @returns `true` if the value is the boolean `true` value or a string that can
285 > * be clearly mapped to a boolean (e.g., `"true"`, `"TRUE"`, `"FaLSe"`, etc.),
286 > * `undefined` for rest of the values
287 > */
288 > export function asBoolean(value: unknown): boolean | undefined {
289 if (typeof value === 'boolean') {
290 return value;
306 return undefined;
307 }
308 > config.ts
309 > /**
310 > * Helper to check if a path starts with tilde (user home).
311 > * Only supports Unix-style (`~/`) paths for cross-platform sharing.
312 > * Backslash paths (`~\`) are not supported to ensure paths are shareable in repos.
313 > *
314 > * @param path - path to check
315 > * @returns `true` if the path starts with `~/`
316 > */
317 > export function isTildePath(path: string): boolean {
318 return path.startsWith('~/');
319 }