Skip to content

Commit a054f1a

Browse files
committed
update config keys
1 parent 78328fe commit a054f1a

File tree

3 files changed

+37
-24
lines changed

3 files changed

+37
-24
lines changed

src/vs/platform/prompts/common/config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
import { IConfigurationService } from '../../configuration/common/configuration.js';
77

8+
// TODO: @lego - update the docs
9+
// TODO: @lego - update unit tests
10+
811
/**
912
* Configuration helper for the `reusable prompts` feature.
1013
* @see {@link CONFIG_KEY} and {@link LOCATIONS_CONFIG_KEY}.
@@ -67,15 +70,15 @@ import { IConfigurationService } from '../../configuration/common/configuration.
6770
*/
6871
export namespace PromptsConfig {
6972
/**
70-
* Configuration key for the `prompt files` feature (also
71-
* known as `prompt files`, `prompt instructions`, etc.).
73+
* Configuration key for the `reusable prompts` feature
74+
* (also known as `prompt files`, `prompt instructions`, etc.).
7275
*/
7376
export const CONFIG_KEY: string = 'chat.reusablePrompts';
7477

7578
/**
7679
* Configuration key for the locations of reusable prompt files.
7780
*/
78-
export const LOCATIONS_CONFIG_KEY: string = 'chat.reusablePrompt.locations';
81+
export const LOCATIONS_CONFIG_KEY: string = 'chat.reusablePromptsLocations';
7982

8083
/**
8184
* Default reusable prompt files source folder.

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ configurationRegistry.registerConfiguration({
216216
disallowConfigurationDefault: true,
217217
tags: ['experimental'],
218218
},
219+
// TODO: @lego - add more tags?
219220
[PromptsConfig.LOCATIONS_CONFIG_KEY]: {
220221
type: 'object',
221222
title: nls.localize(

src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.ts

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ import { URI } from '../../../../../../base/common/uri.js';
88
import { CHAT_CATEGORY } from '../../actions/chatActions.js';
99
import { IChatWidget, IChatWidgetService } from '../../chat.js';
1010
import { KeyMod, KeyCode } from '../../../../../../base/common/keyCodes.js';
11+
import { Registry } from '../../../../../../platform/registry/common/platform.js';
1112
import { IViewsService } from '../../../../../services/views/common/viewsService.js';
1213
import { isPromptFile } from '../../../../../../platform/prompts/common/constants.js';
14+
import { LifecyclePhase } from '../../../../../services/lifecycle/common/lifecycle.js';
1315
import { IEditorService } from '../../../../../services/editor/common/editorService.js';
1416
import { ICommandService } from '../../../../../../platform/commands/common/commands.js';
1517
import { appendToCommandPalette } from '../../../../files/browser/fileActions.contribution.js';
1618
import { ServicesAccessor } from '../../../../../../platform/instantiation/common/instantiation.js';
19+
import { IWorkbenchContributionsRegistry, Extensions } from '../../../../../common/contributions.js';
1720
import { IActiveCodeEditor, isCodeEditor, isDiffEditor } from '../../../../../../editor/browser/editorBrowser.js';
1821
import { KeybindingsRegistry, KeybindingWeight } from '../../../../../../platform/keybinding/common/keybindingsRegistry.js';
1922
import { IChatAttachPromptActionOptions, ATTACH_PROMPT_ACTION_ID } from '../../actions/chatAttachPromptAction/chatAttachPromptAction.js';
@@ -63,27 +66,6 @@ const command = async (
6366
await commandService.executeCommand(ATTACH_PROMPT_ACTION_ID, options);
6467
};
6568

66-
/**
67-
* Register the "Use Prompt" command with its keybinding.
68-
*/
69-
KeybindingsRegistry.registerCommandAndKeybindingRule({
70-
id: COMMAND_ID,
71-
weight: KeybindingWeight.WorkbenchContrib,
72-
primary: COMMAND_KEY_BINDING,
73-
handler: command,
74-
});
75-
76-
/**
77-
* Register the "Use Prompt" command in the `command palette`.
78-
*/
79-
appendToCommandPalette(
80-
{
81-
id: COMMAND_ID,
82-
title: localize('commands.prompts.use.title', "Use Prompt"),
83-
category: CHAT_CATEGORY,
84-
},
85-
);
86-
8769
/**
8870
* Get chat widget reference to attach prompt to.
8971
*/
@@ -144,3 +126,30 @@ const getActivePromptUri = (
144126

145127
return undefined;
146128
};
129+
130+
/**
131+
* Register the "Use Prompt" command with its keybinding.
132+
*/
133+
KeybindingsRegistry.registerCommandAndKeybindingRule({
134+
id: COMMAND_ID,
135+
weight: KeybindingWeight.WorkbenchContrib,
136+
primary: COMMAND_KEY_BINDING,
137+
handler: command,
138+
});
139+
140+
/**
141+
* Register the "Use Prompt" command in the `command palette`.
142+
*/
143+
appendToCommandPalette(
144+
{
145+
id: COMMAND_ID,
146+
title: localize('commands.prompts.use.title', "Use Prompt"),
147+
category: CHAT_CATEGORY,
148+
},
149+
);
150+
151+
class RunIfEnabled { }
152+
153+
// register the command as a workbench contribution
154+
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench)
155+
.registerWorkbenchContribution(RunIfEnabled, LifecyclePhase.Eventually);

0 commit comments

Comments
 (0)