Skip to content

Commit 14b618e

Browse files
authored
docs: clarify setting ID and display title rules (#7658)
1 parent 5f9b712 commit 14b618e

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

api/references/contribution-points.md

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ See the [Commands Extension Guide](https://code.visualstudio.com/api/extension-g
141141

142142
## contributes.configuration
143143

144-
Contribute configuration keys that will be exposed to the user. The user will be able to set these configuration options in the Settings editor or by editing a settings.json file directly.
144+
Contribute settings that will be exposed to the user. The user will be able to set these configuration options in the Settings editor or by editing a settings.json file directly.
145145

146146
This section can either be a single object, representing a single category of settings, or an array of objects, representing multiple categories of settings. If there are multiple categories of settings, the Settings editor will show a submenu in the table of contents for that extension, and the title keys will be used for the submenu entry names.
147147

@@ -191,7 +191,7 @@ The `title` 1️⃣️ of a category is the heading used for that category.
191191
}
192192
```
193193

194-
Note that if the extension has multiple categories of extensions, and the title of one of the categories is the same as the extension display name, then the settings for that category will be placed directly below the main extension heading, no matter what the `order` field is set to.
194+
For an extension with multiple categories of settings, if the title of one of the categories is the same as the extension's display name, then the settings UI will treat that category as a "default category", ignoring the `order` field for that category and placing its settings below the main extension heading.
195195

196196
For both the `title` and `displayName` fields, words like "Extension", "Configuration", and "Settings" are redundant.
197197

@@ -202,32 +202,25 @@ For both the `title` and `displayName` fields, words like "Extension", "Configur
202202

203203
#### properties
204204

205-
The `properties` 2️⃣ in your configuration will be a dictionary of configuration properties.
205+
The `properties` 2️⃣ in your `configuration` object will form a dictionary where the keys are setting IDs and the values give more information on the setting. Though an extension can contain multiple categories of settings, each setting of the extension must still have its own unique ID. A setting ID cannot be a complete prefix of another setting ID.
206206

207-
In the settings UI, your configuration key will be used to namespace and construct a title. Though an extension can contain multiple categories of settings, each setting of the extension must still have its own unique key. Capital letters in your key are used to indicate word breaks. For example, if your key is `gitMagic.blame.dateFormat`, the generated title for the setting will look like this:
207+
Properties without an explicit `order` field will appear in lexicographical order in the settings UI (**not** the order in which they're listed in the manifest).
208208

209-
> Blame: **Date Format**
209+
### Setting titles
210210

211-
Entries will be grouped according to the hierarchy established in your keys. So for example, these entries
211+
In the settings UI, multiple fields will be used to construct a display title for each setting. Capital letters in your key are used to indicate word breaks.
212212

213-
```text
214-
gitMagic.blame.dateFormat
215-
gitMagic.blame.format
216-
gitMagic.blame.heatMap.enabled
217-
gitMagic.blame.heatMap.location
218-
```
213+
#### Display titles for single-category and default category configurations
214+
215+
If the configuration has a single category of settings, or if the category has the same title as the extension's display name, then for settings within that category, the settings UI will use the settings ID and the extension `name` field to determine the display title.
216+
217+
As an example, for settings ID `gitMagic.blame.dateFormat` and extension name `authorName.gitMagic`, because the prefix of the settings ID matches with the suffix of the extension name, the `gitMagic` part of the settings ID will be removed in the display title: "Blame: **Date Format**".
219218

220-
will appear in a single group like this:
219+
#### Display titles for multi-category configurations
221220

222-
> Blame: **Date Format**
223-
>
224-
> Blame: **Format**
225-
>
226-
> Blame › Heat Map: **Enabled**
227-
>
228-
> Blame › Heat Map: **Location**
221+
If the configuration has multiple categories of settings, and the category does not have the same title as the extension's display name, then for settings within that category, the settings UI will use the settings ID and the category `id` field to determine the display title.
229222

230-
Otherwise, properties without an explicit order field appear in alphabetical order (**not** the order in which they're listed in the manifest).
223+
As an example, for settings ID `css.completion.completePropertyWithSemicolon` and category ID `css`, because the prefix of the settings ID matches with the suffix of the category ID, the `css` part of the settings ID will be removed in the settings UI, and the generated title for the setting will be "Completion: **Complete Property With Semicolon**".
231224

232225
### Configuration property schema
233226

@@ -246,7 +239,7 @@ Your `description` 3️⃣ appears after the title and before the input field, e
246239
}
247240
```
248241

249-
If you use `markdownDescription` instead of `description`, your setting description will be rendered as Markdown in the settings UI.
242+
If you use `markdownDescription` instead of `description`, your setting description will be parsed as Markdown in the settings UI.
250243

251244
```json
252245
{
@@ -274,7 +267,7 @@ Entries of type `number` 4️⃣ , `string` 5️⃣ , `boolean` 6️⃣ can be e
274267

275268
A string setting can be rendered with a multiline text input if it sets `"editPresentation": "multilineText"` on the configuration entry.
276269

277-
For `boolean` entries, the `description` (or `markdownDescription`) will be used as the label for the checkbox.
270+
For `boolean` entries, the `markdownDescription` (or `description` if `markdownDescription` is not specified) will be used as the label next to the checkbox.
278271

279272
```json
280273
{
@@ -297,7 +290,7 @@ If two categories have `order` properties, the category with the lower order num
297290

298291
If two settings within the same category have `order` properties, the setting with the lower order number comes first. If another setting within that same category is not given an `order` property, it will appear after settings in that category that were given that property.
299292

300-
If two categories have the same `order` property value, or if two settings within the same category have the same `order` property value, then they will be sorted in increasing alphabetical order within the settings UI.
293+
If two categories have the same `order` property value, or if two settings within the same category have the same `order` property value, then they will be sorted in increasing lexicographical order within the settings UI.
301294

302295
#### enum / enumDescriptions / markdownEnumDescriptions / enumItemLabels
303296

0 commit comments

Comments
 (0)