submenu on context menuitem in vscode extensions - vscode-extensions

i see a lot of github issues that seem to indicate that the ability to add a submenu that drops down when we click on a custom context menu item, say in explorer/context, was added in Sep 2020, but i can't find it in the extensions documentation.
can someone point me to that?
Thanks,
Nilesh

The syntax:
{
"contributes": {
"menus": {
"scm/title": [
{
"command": "git.commit",
"group": "navigation"
},
{
"submenu": "git.stage",
"group": "navigation"
}
],
"git.stage": [
{
"command": "git.stageAll",
"group": "navigation"
},
{
"command": "git.stageUntracked",
"group": "navigation"
}
]
},
"submenus": [
{
"id": "git.stage",
"label": "Stage",
"icon": "$(something)"
}
]
}
}
see: https://github.com/microsoft/vscode/issues/100172#issuecomment-645203070

Related

How to add new or existing multi-select tags when creating a page in Notion API?

I can't figure out how to add multi-select tags when creating a page in Notion API. Single select tags are extremely easy to add:
"City": {
"select": {
"name": "New York",
}
}
But my attempts to add multi-select tags end up failing.
"City": {
"multi_select": {
"options": [
{
"name": "New York",
"color": "red"
},
{
"name": "Tbilisi",
"color": "gray"
}
]},
}
Here's the error I get
{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\nbody.properties.City.title should be defined, instead was `undefined`.\nbody.properties.City.rich_text should be defined, instead was `undefined`.\nbody.properties.City.number should be defined, instead was `undefined`.\nbody.properties.City.url should be defined, instead was `undefined`.\nbody.properties.City.select should be defined, instead was `undefined`.\nbody.properties.City.multi_select should be an array, instead was `{\"options\":[{\"name\":\"apple\",\"color\":\"red\"},{\"name\":\"Ora...`.\nbody.properties.City.people should be defined, instead was `undefined`.\nbody.properties.City.email should be defined, instead was `undefined`.\nbody.properties.City.phone_number should be defined, instead was `undefined`.\nbody.properties.City.date should be defined, instead was `undefined`.\nbody.properties.City.checkbox should be defined, instead was `undefined`.\nbody.properties.City.relation should be defined, instead was `undefined`.\nbody.properties.City.files should be defined, instead was `undefined`.\nbody.properties.City.status should be defined, instead was `undefined`.\nbody.properties.Name.id should be defined, instead was `undefined`.\nbody.properties.Name.name should be defined, instead was `undefined`.\nbody.properties.Name.start should be defined, instead was `undefined`."}
Do you have a working example of how it should be done?
Here's the full payload
newPageData = {
"parent": { "database_id": 'some id' },
"properties": {
"Name": {
"title": [
{
"text": {
"content": "New page"
}
}
]
},
"City": {
"multi_select": {
"options": [
{
"name": "New York",
"color": "red"
},
{
"name": "Tbilisi",
"color": "gray"
}
]},
},
"Date": {
"date": {
"start": "2023-02-06",
"end": None,
}
},
"Link": {
"url": "example.info"
}
}
}
When populating / updating a Multi-Select property, you don't need to include "options" or specify the option's colour so this should work -
"City": {
"multi_select": [
{
"name": "New York"
},
{
"name": "Tbilisi"
}
]
}
you should remove the first comma at the end of your list of options for the City property too -
]},
},

User defined colors in textmate grammar?

I use TexMate grammar to change colors of certain keywords/lines in output pane.:
my-output.tmLanguage.json
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "my-output",
"scopeName": "source.my-output",
"patterns": [
{
"match": "foo",
"name": "my-bar"
}
]
}
The colors are hardcoded in package.json as:
"contributes": {
"grammars": [
{
"language": "my-output",
"scopeName": "source.my-output",
"path": "my-output.tmLanguage.json"
}
],
"configurationDefaults": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "my-foo",
"settings": {
"foreground": "#123456"
}
}
]
}
}
}
Does VSCode provide ability to override textmate colors if defined in user's config?

How do you center the map on a clicked symbol using MapBox and React Native?

Spent a long time trying to do this: Mapbox show how to do it here, but I'm unsure how it works in React Native:
https://docs.mapbox.com/mapbox-gl-js/example/center-on-symbol/
I'm using ShapeSource and SymboLayer, getting my markers from a geoJson. I can't seem to target the specific icon and its' coordinates. I've tried something like this, but it just takes be to the first feature location (not the location of the specific icon clicked):
onPress={() => {this._map.flyTo(featureCollection.features.geometry(0).coordinates, 1000);}}
My features look like this:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": 1,
"properties": {
"name": "Hotel",
"icon": "sleep"
},
"geometry": {
"type": "Point",
"coordinates": [
12.584664,
55.680532
]
}
},
{
"type": "Feature",
"id": 2,
"properties": {
"name": "Restaurant",
"icon": "food"
},
"geometry": {
"type": "Point",
"coordinates": [
12.585264,
55.683441
]
}
}
}
Thanks!
I think I've found a working answer to this, but please correct me if you have a better answer:
constructor(props) {
super(props);
this.onPress = this.onPress.bind(this);
}
async onPress(e) {
const feature = e.nativeEvent.payload;
this.map.flyTo(feature.geometry.coordinates, 1000);

How to use theme framework in ambari 2.1 for customized service?

How to use theme framework with ambari to provide theme like combo,slider to the property? I need to add a toggle with yes or no property for licence.
I am following the below link but not able to see themes for the customize service.
http://search-hadoop.com/m/g7Bc62I7Ncfx9tB1&subj=Re+Using+theme+framework+on+my+own+stack
Steps which i have done:
Added theme.json entry in metainfo.xml
Created theme.json as:
{
"name": "default",
"description": "Default theme for HBASE service",
"configuration": {
"layouts": [
{
"name": "default",
"tabs": [
{
"name": "settings",
"display-name": "Settings",
"layout": {
"tab-columns": "3",
"tab-rows": "3",
"sections": [
{
"name": "section-memory",
"display-name": "Server",
"row-index": "0",
"column-index": "0",
"row-span": "1",
"column-span": "2",
"section-columns": "2",
"section-rows": "1",
"subsections": [
{
"name": "subsection-col1",
"row-index": "0",
"column-index": "0",
"row-span": "1",
"column-span": "1"
},
{
"name": "subsection-col2",
"row-index": "0",
"column-index": "1",
"row-span": "1",
"column-span": "1"
}
]
}
]
}
}
]
}
],
"placement": {
"configuration-layout": "default",
"configs": [
{
"config": "genera/licence",
"subsection-name": "subsection-col1"
}
]
},
"widgets": [
{
"config": "genera/licence",
"widget": {
"type": "toggle"
}
}
]
}
}
In general.xml present in configuration folder as:
Added following entry:
enter image description here
But still it is not reflecting it.
Above steps work fine. Mistake was wrong spelling of general in theme.json file. After correcting, it worked correctly.

Jira REST API: create issue linked to another one

I'd like to link an issue to an existing one at creation using the REST API. The idea is not to CREATE then UPDATE, but just CREATE.
Here is my JSON:
{
"issueUpdates": [
{
"fields": {
"project": {
"key": "CMDB"
},
"issuetype": {
"id": "10500"
},
"summary": "VMP-MYSQL-01",
"issuelinks": [
{
"type": {
"name": "Relates",
"inward": "relates to",
"outward": "relates to"
},
"inwardIssue": {
"key": "CMDB-825"
},
"outwardIssue": "CMDB-825"
}
],
"customfield_10600": "VMP-MYSQL-01"
}
}
]
}
The error I get is:
{
"issues": [],
"errors": [
{
"status": 400,
"elementErrors": {
"errorMessages": [],
"errors": {
"issuelinks": "Field does not support update 'issuelinks'"
}
},
"failedElementNumber": 0
}
]
}
Does the API support the creation of Linked Issue at creation? Using the GUI works.
Jira is running v6.2.
Since this question is a bit older, I've been experiencing same issue as you. After some searching I found that instead of fields you can use update in the json you send to server.
Alternatively, you can use issueLink method to add links after creating the issue.
Complete code to create an issue with a link to a different issue:
{
"fields": {
"summary": "Sample Issue",
"project": {
"id": 14505
},
"issuetype": {
"id": 11002
}
},
"update": {
"issuelinks": [
{
"add": {
"type": {
"name": "Relates"
},
"inwardIssue": {
"key": "PRJ-1"
}
}
}
]
}
}
This will solve your problem. This will create an issue with one jira issue linked to it.
key is a project key,
Blocks or related to whichever you want.
put below json into http://jsonlint.com/. It will do proper formatting.
{
"fields": {
"summary": "Test Adapter",
"project": {
"key": "WFM"
},
"description": "Testing of Jira from Adapter",
"issuetype": {
"name": "Bug"
},
"update": {
"issuelinks": [{
"add": {
"type": {
"name": "Blocks",
"inward": "is blocked by",
"outward": "blocks"
},
"outwardIssue": {
"key": "WFM-28",
"fields": {
"summary": "Test Adapter"
}
}
}
}]
}
}
}