Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/vs/platform/prompts/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
*--------------------------------------------------------------------------------------------*/

import { ContextKeyExpr } from '../../contextkey/common/contextkey.js';
import { IConfigurationService } from '../../configuration/common/configuration.js';
import type { IConfigurationService } from '../../configuration/common/configuration.js';
import { CONFIG_KEY, DEFAULT_SOURCE_FOLDER, LOCATIONS_CONFIG_KEY } from './constants.js';

/**
* Configuration helper for the `reusable prompts` feature.
Expand All @@ -27,21 +28,8 @@ import { IConfigurationService } from '../../configuration/common/configuration.
* - current root folder (if a single folder is open)
*/
export namespace PromptsConfig {
/**
* Configuration key for the `reusable prompts` feature
* (also known as `prompt files`, `prompt instructions`, etc.).
*/
export const CONFIG_KEY: string = 'chat.promptFiles';

/**
* Configuration key for the locations of reusable prompt files.
*/
export const LOCATIONS_CONFIG_KEY: string = 'chat.promptFilesLocations';

/**
* Default reusable prompt files source folder.
*/
export const DEFAULT_SOURCE_FOLDER = '.github/prompts';
export const KEY = CONFIG_KEY;
export const LOCATIONS_KEY = LOCATIONS_CONFIG_KEY;

/**
* Checks if the feature is enabled.
Expand Down
16 changes: 16 additions & 0 deletions src/vs/platform/prompts/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ export const PROMPT_FILE_EXTENSION = '.prompt.md';
*/
const COPILOT_CUSTOM_INSTRUCTIONS_FILENAME = 'copilot-instructions.md';

/**
* Configuration key for the `reusable prompts` feature
* (also known as `prompt files`, `prompt instructions`, etc.).
*/
export const CONFIG_KEY: string = 'chat.promptFiles';

/**
* Configuration key for the locations of reusable prompt files.
*/
export const LOCATIONS_CONFIG_KEY: string = 'chat.promptFilesLocations';

/**
* Default reusable prompt files source folder.
*/
export const DEFAULT_SOURCE_FOLDER = '.github/prompts';

/**
* Check if provided path is a reusable prompt file.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/prompts/test/common/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const createMock = <T>(value: T): IConfigurationService => {
);

assert(
[PromptsConfig.CONFIG_KEY, PromptsConfig.LOCATIONS_CONFIG_KEY].includes(key),
[PromptsConfig.KEY, PromptsConfig.LOCATIONS_KEY].includes(key),
`Unsupported configuration key '${key}'.`,
);

Expand Down
12 changes: 6 additions & 6 deletions src/vs/workbench/contrib/chat/browser/chat.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { IInstantiationService } from '../../../../platform/instantiation/common
import product from '../../../../platform/product/common/product.js';
import { IProductService } from '../../../../platform/product/common/productService.js';
import { PromptsConfig } from '../../../../platform/prompts/common/config.js';
import { PROMPT_FILE_EXTENSION } from '../../../../platform/prompts/common/constants.js';
import { DEFAULT_SOURCE_FOLDER as PROMPT_FILES_DEFAULT_SOURCE_FOLDER, PROMPT_FILE_EXTENSION } from '../../../../platform/prompts/common/constants.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { EditorPaneDescriptor, IEditorPaneRegistry } from '../../../browser/editor.js';
import { Extensions, IConfigurationMigrationRegistry } from '../../../common/configuration.js';
Expand Down Expand Up @@ -244,7 +244,7 @@ configurationRegistry.registerConfiguration({
default: false,
description: nls.localize('mpc.discovery.enabled', "Enable discovery of Model Context Protocol servers on the machine."),
},
[PromptsConfig.CONFIG_KEY]: {
[PromptsConfig.KEY]: {
type: 'boolean',
title: nls.localize(
'chat.reusablePrompts.config.enabled.title',
Expand All @@ -261,7 +261,7 @@ configurationRegistry.registerConfiguration({
disallowConfigurationDefault: true,
tags: ['experimental', 'prompts', 'reusable prompts', 'prompt snippets', 'instructions'],
},
[PromptsConfig.LOCATIONS_CONFIG_KEY]: {
[PromptsConfig.LOCATIONS_KEY]: {
type: 'object',
title: nls.localize(
'chat.reusablePrompts.config.locations.title',
Expand All @@ -274,18 +274,18 @@ configurationRegistry.registerConfiguration({
DOCUMENTATION_URL,
),
default: {
[PromptsConfig.DEFAULT_SOURCE_FOLDER]: true,
[PROMPT_FILES_DEFAULT_SOURCE_FOLDER]: true,
},
additionalProperties: { type: 'boolean' },
unevaluatedProperties: { type: 'boolean' },
restricted: true,
tags: ['experimental', 'prompts', 'reusable prompts', 'prompt snippets', 'instructions'],
examples: [
{
[PromptsConfig.DEFAULT_SOURCE_FOLDER]: true,
[PROMPT_FILES_DEFAULT_SOURCE_FOLDER]: true,
},
{
[PromptsConfig.DEFAULT_SOURCE_FOLDER]: true,
[PROMPT_FILES_DEFAULT_SOURCE_FOLDER]: true,
'/Users/vscode/repos/prompts': true,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const mockConfigService = <T>(value: T): IConfigurationService => {
);

assert(
[PromptsConfig.CONFIG_KEY, PromptsConfig.LOCATIONS_CONFIG_KEY].includes(key),
[PromptsConfig.KEY, PromptsConfig.LOCATIONS_KEY].includes(key),
`Unsupported configuration key '${key}'.`,
);

Expand Down
Loading