VS Code Extension: How do you set an order/priority to the extension's settings/configurations? - visual-studio-code

When adding the settings/configurations to the extensions package.json file under "contributes" and "configuration" no matter what order I place them they appear in the "File" | "Preferences" | "Settings" | "My Extension" as alphabetical. Not all information is logical to present alphabetically, sometimes information is normally presented in a specific order regardless of alpha order.
Lets say for example I needed the following to appear as "Setting C", "Setting B", then "Setting A". The following would still show in the order "Setting A", "Setting B", then "Setting C".
"contributes": {
"configuration": [
{
"type": "object",
"title": "My Extension",
"properties": {
"my-extension.settingB": {
"type": "string",
"default": "Sample B",
"description": "This is a test B setting."
},
"my-extension.settingA": {
"type": "string",
"default": "Sample A",
"description": "This is a test A setting."
},
"my-extension.settingC": {
"type": "string",
"default": "Sample C",
"description": "This is a test C setting."
}
}
}
]
},
I've been combing the VS Code API: Contribution Points, Extension Guides, and Google but cant seem to find where/if we can set an order or priority to the extension's settings/configuration.
Is this something that's available? It seems like a fairly basic request as not all data needs to be sorted alphabetically.
I've tried to follow all the rules for posting but This is my first post so let me know if I haven't done something correctly.

It looks like extension settings ordering is coming to vscode v1.63. It works in the Insiders Build now. See Test: Extension settings ordering.
"contributes": {
"configuration": [
{
"type": "object",
"title": "My Extension",
"properties": {
"my-extension.settingB": {
"type": "string",
"default": "Sample B",
"description": "This is a test B setting.",
"order" 2
},
"my-extension.settingA": {
"type": "string",
"default": "Sample A",
"description": "This is a test A setting.",
"order": 3
},
"my-extension.settingC": {
"type": "string",
"default": "Sample C",
"description": "This is a test C setting.",
"order": 1
}
}
}
]
},
Note the new order property above.
From the link above:
Settings with order fields are sorted based on increasing order, so a
setting with order -2 comes before a setting with order 25. It doesn't
matter what actual numbers are used, as long as there is an ordering
given.
Setting-level order fields only apply to settings within that
category.
Settings without order fields will be placed at the end of their
category in alphabetical order. This also means if two settings within
the same category have the same order number for whatever reason, they
should be sorted in alphabetical order.
For a more complex example see settings order package.json example

It looks like this is indeed not possible at the moment. There is a related issue on the VSCode repo that seems to confirm that:
Explore extending settings schema with additional metadata (#51778)
Yeah, I would love to be able to group settings, order them, and maybe hide some. Right now the alphabetic ordering, causes all of GitLens' advanced settings to be first in the list, and that is far from ideal.
Also related: Settings UI is overwhelming for extensions with lots of settings (#70589)

It would indeed be helpful to have more control over the order. Groupings would also be helpful. Not grouping related items together can cause confusion for users.

Related

How to add configurations to user to a VSCode extension

I am trying to add a simple configuration to my VSCode extension, but I can't find the correct information.
I just want that the user have a string input field, that has a default value, and read it from my typescript code through the vscode library
Can someone provide me and example about which file should I add, where, and how to consume? also if more configurations are needed.
Thanks!
Ok, found
I need to add into my package.json
...
"contributes": {
"commands": [
...
],
"configuration": {
"title": "My Extension",
"properties": {
"myExtension.myProperty": {
"type": "string",
"default": "default",
"description": "description"
}
}
}
},
and consume
vscode.workspace.getConfiguration('myExtension').myProperty;

message template are not working in kore.ai

I want to display list to the user with kore.ai, currently, I am using telegram but the template is not working it is just showing the code.
var message={
"type": "template",
"payload":
{
"template_type": "button",
"text": "What do you want to do next?",
"buttons":
[{
"type": "web_url",
"title": "Show Website",
"url": "https://petersapparel.parseapp.com"
},
{
"type": "postback",
"title": "Start Chatting",
"payload": "USER_DEFINED_PAYLOAD"
}
]
}
}
print(JSON.stringify(message));
Expected result:
Some templates are channel specific which means not every end channel supports each and every templates . Please try with different channels such as Web or Facebook messenger, your template will be supported.
You will need to make sure that the template structure is supported by the channel.
The channels usually have the template structures defined on their technical documentation.
Please select the appropriate channel on the bot builder and then use the template structure as they have defined.

Azure DevOps extension custom UI

I've been tasked to develop an extension for Azure DevOps to automate building process - a custom Build Task. The caveat is that in reality what I am developing is a series of build task, each containing regular inputs. But for historical reasons, all these build tasks should be grouped and the user would be able to choose the correct one from a drop-down list on the tasks' page in the pipeline settings.
The issue being is that the change in the drop down should hide SOME of the inputs and show some other inputs as well - i.e. I'd like to handle the CHANGE event of the drop-down and control the visibility of the UI elements.
Is this even possible?
Am I on the wrong track? How can I approach this?
The solution is simple, but it isn't obvious as of yet.
There is a property to each input, called visibleRule which does exactly whats needed: control the visibility of of the input it is attached to. So in the task.json file, in the inputs array, one could do this:
Define the drop-down:
{
"name": "selectedOption",
"type": "pickList",
"label": "Options",
"options": {
"o1": "Option 1",
"o2": "Option 2",
"o3": "Option 3"
}
},
Then define some fields like this:
{
"name": "test1",
"type": "string",
"label": "Option 1 test",
"visibleRule": "selectedOption = o1"
},
{
"name": "test2",
"type": "string",
"label": "Option 2 test",
"visibleRule": "selectedOption = o2"
},
Now the test1 input is diplayed ONLY if o1 (Option 1) is selected in the selectedOption drop-down. The same goes for test2 and o2. Neither test1 nor test2 is displayed if the selectedOption is o3.

Validate referential integrity of object arrays with Joi

I'm trying to validate that the data I am returned it sensible. Validating data types is done. Now I want to validate that I've received all of the data needed to perform a task.
Here's a representative example:
{
"things": [
{
"id": "00fb60c7-520e-4228-96c7-13a1f7a82749",
"name": "Thing 1",
"url": "https://lolagons.com"
},
{
"id": "709b85a3-98be-4c02-85a5-e3f007ce4bbf",
"name": "Thing 2",
"url": "https://lolfacts.com"
}
],
"layouts": {
"sections": [
{
"id": "34f10988-bb3d-4c38-86ce-ed819cb6daee",
"name": "Section 1",
"content:" [
{
"type": 2,
"id": "00fb60c7-520e-4228-96c7-13a1f7a82749" //Ref to Thing 1
}
]
}
]
}
}
So every Section references 0+ Things, and I want to validate that every id value returned in the Content of Sections also exists as an id in Things.
The docs for Object.assert(..) implies that I need a concrete reference. Even if I do the validation within the Object.keys or Array.items, I can't resolve the reference at the other end.
Not that it matters, but my context is that I'm validating HTTP responses within IcedFrisby, a Frisby.js fork.
This wasn't really solveable in the way I asked (i.e. with Joi).
I solved this for my context by writing a plugin for icedfrisby (published on npm here) which uses jsonpath to fetch each id in Content and each id in Things. The plugin will then assert that all of the first set exist within the second.

GET Values from a custom field via JIRA REST API

I would like to GET all drop down options for a custom field. For system fields, I use the following URI:
http://localhost:8080/rest/api/2/project/XXXX/components
(for components, versons, etc. Basically system fields), so I tried the following for a custom field
http://localhost:8080/rest/api/2/project/XXXX/customfield_10000
and got a 404 error. I'm not sure what I'm doing wrong as I've been googling for the past 19 hours. The best I search result I got was the following documentation: JIRA Developers Documentation
Please assist, I'm not sure What I'm missing
You can get that information either from the createmeta or editmeta REST resources.
Use editmeta if you want to retrieve the available options when editing a specific issue. E.g.
GET /rest/api/2/issue/TEST-123/editmeta
Use createmeta when you want to retrieve the options for a project in combination with an issue type. E.g.
GET /rest/api/2/issue/createmeta?projectKeys=MYPROJ&issuetypeNames=Bug&expand=projects.issuetypes.fields
The customfields with options will be returned like this:
"customfield_12345": {
"schema": {
"type": "string",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
"customId": 12345
},
"name": "MySelectList",
"allowedValues": [
{
"self": "http://jira.url/rest/api/2/customFieldOption/14387",
"value": "Green",
"id": "14387"
},
{
"self": "http://jira.url/rest/api/2/customFieldOption/14384",
"value": "Blue",
"id": "14384"
}
]
}