Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prompt files config description update #239279

Merged
merged 3 commits into from
Feb 1, 2025
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
11 changes: 3 additions & 8 deletions src/vs/workbench/contrib/chat/browser/chat.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,9 @@ configurationRegistry.registerConfiguration({
default: true
},
[PromptFilesConfig.CONFIG_KEY]: {
type: ['string', 'array', 'object', 'boolean', 'null'],
title: nls.localize('chat.promptFiles.setting.title', "Prompt Files"),
markdownDescription: nls.localize(
'chat.promptFiles.setting.markdownDescription',
"Enable support for attaching reusable prompt files (`*{0}`) for Chat, Edits, and Inline Chat sessions. [Learn More]({1}).",
'.prompt.md',
PromptFilesConfig.DOCUMENTATION_URL,
),
type: ['boolean', 'object', 'array', 'string', 'null'],
title: PromptFilesConfig.CONFIG_TITLE,
markdownDescription: PromptFilesConfig.CONFIG_DESCRIPTION,
default: null,
tags: ['experimental'],
},
Expand Down
45 changes: 40 additions & 5 deletions src/vs/workbench/contrib/chat/common/promptSyntax/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as nls from '../../../../../nls.js';
import { PROMPT_SNIPPET_FILE_EXTENSION } from './contentProviders/promptContentsProviderBase.js';
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';

/**
Expand All @@ -21,21 +23,21 @@ import { IConfigurationService } from '../../../../../platform/configuration/com
* (see {@link DEFAULT_LOCATION}):
* ```json
* {
* "chat.experimental.promptSnippets": true,
* "chat.promptFiles": true,
* }
* ```
*
* Enable the feature, specifying a single prompt files source folder location:
* ```json
* {
* "chat.experimental.promptSnippets": '.github/prompts',
* "chat.promptFiles": '.github/prompts',
* }
* ```
*
* Enable the feature, specifying multiple prompt files source folder location:
* ```json
* {
* "chat.experimental.promptSnippets": {
* "chat.promptFiles": {
* ".github/prompts" : true,
* ".copilot/prompts" : false,
* "/Users/legomushroom/repos/prompts" : true,
Expand All @@ -46,7 +48,7 @@ import { IConfigurationService } from '../../../../../platform/configuration/com
* Enable the feature, specifying multiple prompt files source folder location:
* ```json
* {
* "chat.experimental.promptSnippets": [
* "chat.promptFiles": [
* ".github/prompts",
* ".copilot/prompts",
* "/Users/legomushroom/repos/prompts",
Expand All @@ -64,7 +66,7 @@ import { IConfigurationService } from '../../../../../platform/configuration/com
* (see {@link DEFAULT_LOCATION}):
* ```json
* {
* "chat.experimental.promptSnippets": {},
* "chat.promptFiles": {},
* }
* ```
*
Expand Down Expand Up @@ -213,6 +215,39 @@ export namespace PromptFilesConfig {

return DEFAULT_LOCATION;
};

const usageExample1 = nls.localize(
`chat.promptFiles.config.description.example1`,
"Enable with the default location of the prompt files (`{0}`):\n{1}",
DEFAULT_LOCATION[0],
`\`\`\`json\n{\n "${CONFIG_KEY}": true,\n}\n\`\`\``,
);
const usageExample2 = nls.localize(
`chat.promptFiles.config.description.example2`,
"Specify custom location(s) of the prompt files:\n{0}",
`\`\`\`json\n{\n "${CONFIG_KEY}": {\n ".github/prompts": true,\n "/Users/vscode/prompts": true,\n}\n\`\`\``,
);

/**
* Configuration setting description to use in the settings UI.
*/
export const CONFIG_DESCRIPTION = nls.localize(
'chat.promptFiles.config.description',
"Enable support for attaching reusable prompt files (`*{0}`) for Chat, Edits, and Inline Chat sessions. [Learn More]({1}).\n\nSet to `true` or use the `{ \"/path/to/folder\": boolean }` notation to specify a different path (or a couple of them). Relative paths are resolved from the root folder(s) of your workspace, and the default value of `{2}` is used if no other paths provided.\n#### Examples\n{3}\n{4}",
PROMPT_SNIPPET_FILE_EXTENSION,
DOCUMENTATION_URL,
DEFAULT_LOCATION[0],
usageExample1,
usageExample2,
);

/**
* Configuration setting title to use in the settings UI.
*/
export const CONFIG_TITLE = nls.localize(
`chat.promptFiles.config.title`,
"Prompt Files",
);
}

/**
Expand Down
Loading