Can we clone a code and separate them with number in certain position? - webautomation

I'm using UI Vision and trying to make loop code. This is the main code:
{
"Command": "click",
"Target": "xpath=//*[#id=\"XXXXX\"]/div/div[2]/div/div[2]/div[3]/div/div/div/div[2]/section/article[2]/button",
"Value": "",
"Targets": [
"xpath=//*[#id=\"XXXXX\"]/div/div[2]/div/div[2]/div[3]/div/div/div/div[2]/section/article[2]/button",
"xpath=//article[2]/button",
"css=#XXXXX > div > div.profile-detail-right-panel > div > div.sidebar-panels > div.panel-container.requireLogin.selected > div > div.scroller.is-scrollable.scroll-content.scroll-scrolly_visible > div > div.profile-user-list-container > section > article:nth-child(5) > button"
],
"Description": ""
}
There is XXXX/article[2] which means it's the 2nd loop.
My questions is, is there any fastest way to clone that code until 100x loops or until XXXX/article[100] ?
Thank you. Any help would be really appreciated.

Related

Change position of a TreeView to the Panel from ActivityBar

I'm fully able to move my TreeView from the SideBar to the bottom panel (Problems, output, terminal...).
However, I'm uncertain how I would go about making my TreeView appear in the bottom panel by default. The documentation doesn't state anything about the bottom panel.
Any ideas?
I see the panel as an option for the viewContainer as in:
"contributes": {
"viewsContainers": {
"panel" : [ // instead of activityBar here
{
"id": "your virewContainer id",
"title": "your title",
"icon": "$(....)"
}
]
}
}
Found by using intellisense.

cannot make VSCode Snippet $TM_CURRENT_LINE work

I created this custom snippet to get line number with alert
"alert-line": {
"scope": "javascript,typescript",
"prefix": "al",
"body": [
"alert(`Line $TM_CURRENT_LINE`);",
],
"description": "alert line"
},
as output I get something weird
alert(`Line al`);
You want TM_LINE_NUMBER or TM_LINE_INDEX, see https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables.
Your output is correct for $TM_CURRENT_LINE which is the text on the current line. And since your prefix was al and you typed that on an line with a few tabs only - that was the current line's text.

Why will my vs-code snippet not work when the format has been met?

i am trying to get the snippet to do this
recipes.addShaped("name", output,
[
[input,input,input],
[input,input,input],
[input,input,input]
]);
the code i am trying to use is this
"Add a shaped": {
"prefix": ["rec", "add"],
"body": ["
recipes.addShaped("${1:name}", ${2:output},
[
[${3:input},${4:input},${5:input}],
[${6:input},${7:input},${8:input}],
[${9:input},${10:input},${11:input}]
]);
"],
"description": "Add a shaped recipe."
}
any help would be appreciated.
dan
Try this:
"Add a shaped": {
"prefix": ["rec", "add"],
"body": [
"recipes.addShaped(\"${1:name}\", ${2:output},",
"[",
"[${3:input},${4:input},${5:input}],",
"[${6:input},${7:input},${8:input}],",
"[${9:input},${10:input},${11:input}]",
"]);"
],
"description": "Add a shaped recipe."
},
All lines of the body have to be separately quoted and the qoutes within a line have to be escaped.
And the result will appear flush left with your current indentation without having to put the body far left like you had it. Just indent the snippet normally to set the left point. Any indentation from there will indent the result.

How to add space in vscode emmet key suggestions?

There is inbuilt emmet suggestion of #media like in the image below and I wanted to add my custom snippets for max-width and min-width. Which I successfully did with below codes.
{
"css": {
"snippets": {
"#mediaMaxWidth": "#media(max-width: ${1:768}px) {\n\t${2}\n}",
"#mediaMinWidth": "#media(min-width: ${1:768}px) {\n\t${2}\n}"
}
}
}
Problem: : Like in inbuilt emmet there is space between #media screen , I want to create same for my custom one to looks like it so it become #media max-width and #media min-width which I can't seems to achieve.
What I tried and what I expected it to work:
{
"css": {
"snippets": {
"#media max-width": "#media(max-width: ${1:768}px) {\n\t${2}\n}",
"#media min-width": "#media(min-width: ${1:768}px) {\n\t${2}\n}"
}
}
}
There’s no way to add space in abbreviation shortcut. What you see in screenshot is a preview of expanded result, not actual snippet
As #Mark had mentioned in the comment, we can put snippets in snippets/css.json (less.json) if you use less. BUT snippet structure looks different.
To add snippets open File > Preferences > User Snippets then choose the language you want to add snippets to, in this case i choose css.
Add codes based on the documentation in the file it self. Based on my requirement codes look like this.
"media min width 768px": {
"prefix": "#media min-width",
"body": [
"#media(min-width: ${1:768}px) {\n\t${2}\n}",
"$3"
],
"description": "Media min width"
},
"media max width 768px": {
"prefix": "#media max-width",
"body": [
"#media(max-width: ${1:768}px) {\n\t${2}\n}",
"$3"
],
"description": "Media max width"
}
Result:

vscode snippets: repeat what's being typed into given location on the snippet body

I want to know if I can repeat whats being typed on position $1 into the snippet location shown below:
"BootstrapCol": {
"prefix": "BSCol",
"body": [
"<div class="col-$1">$0</div><!-- ./col-{REPEAT WHAT IS BEING TYPED HERE} -->"
],
"description": "Create a Bootstrap Grid col Markup"
}
If so, how?
"<div class=\"col-${1}\">$0</div><!-- ./col-${1} -->"