@@ -7,11 +7,11 @@ import { IConfigurationService } from '../../configuration/common/configuration.
7
7
8
8
/**
9
9
* Configuration helper for the `reusable prompts` feature.
10
- * @see {@link CONFIG_KEY }.
10
+ * @see {@link CONFIG_KEY } and { @link LOCATIONS_CONFIG_KEY } .
11
11
*
12
12
* ### Functions
13
13
*
14
- * - {@link getValue } allows to current read configuration value
14
+ * - {@link getLocationsValue } allows to current read configuration value
15
15
* - {@link enabled} allows to check if the feature is enabled
16
16
* - {@link promptSourceFolders} gets list of source folders for prompt files
17
17
*
@@ -70,20 +70,38 @@ export namespace PromptsConfig {
70
70
* Configuration key for the `prompt files` feature (also
71
71
* known as `prompt files`, `prompt instructions`, etc.).
72
72
*/
73
- export const CONFIG_KEY : string = 'chat.promptFiles' ;
73
+ export const CONFIG_KEY : string = 'chat.reusablePrompts' ;
74
+
75
+ /**
76
+ * Configuration key for the locations of reusable prompt files.
77
+ */
78
+ export const LOCATIONS_CONFIG_KEY : string = 'chat.reusablePrompt.locations' ;
74
79
75
80
/**
76
81
* Default reusable prompt files source folder.
77
82
*/
78
83
export const DEFAULT_SOURCE_FOLDER = '.github/prompts' ;
79
84
80
85
/**
81
- * Get value of the `prompt files` configuration setting.
86
+ * Checks if the feature is enabled.
87
+ * @see {@link CONFIG_KEY }.
82
88
*/
83
- export const getValue = (
89
+ export const enabled = (
90
+ configService : IConfigurationService ,
91
+ ) : boolean => {
92
+ const enabledValue = configService . getValue ( CONFIG_KEY ) ;
93
+
94
+ return asBoolean ( enabledValue ) ?? false ;
95
+ } ;
96
+
97
+ /**
98
+ * Get value of the `reusable prompt locations` configuration setting.
99
+ * @see {@link LOCATIONS_CONFIG_KEY }.
100
+ */
101
+ export const getLocationsValue = (
84
102
configService : IConfigurationService ,
85
103
) : Record < string , boolean > | undefined => {
86
- const configValue = configService . getValue ( CONFIG_KEY ) ;
104
+ const configValue = configService . getValue ( LOCATIONS_CONFIG_KEY ) ;
87
105
88
106
if ( configValue === undefined || configValue === null || Array . isArray ( configValue ) ) {
89
107
return undefined ;
@@ -111,25 +129,14 @@ export namespace PromptsConfig {
111
129
return undefined ;
112
130
} ;
113
131
114
- /**
115
- * Checks if the feature is enabled.
116
- */
117
- export const enabled = (
118
- configService : IConfigurationService ,
119
- ) : boolean => {
120
- const value = getValue ( configService ) ;
121
-
122
- return value !== undefined ;
123
- } ;
124
-
125
132
/**
126
133
* Gets list of source folders for prompt files.
127
134
* Defaults to {@link DEFAULT_SOURCE_FOLDER}.
128
135
*/
129
136
export const promptSourceFolders = (
130
137
configService : IConfigurationService ,
131
138
) : string [ ] => {
132
- const value = getValue ( configService ) ;
139
+ const value = getLocationsValue ( configService ) ;
133
140
134
141
// note! the `value &&` part handles the `undefined`, `null`, and `false` cases
135
142
if ( value && ( typeof value === 'object' ) ) {
0 commit comments