How to move tabs in Visual Studio Code with the keyboard? - keyboard-shortcuts

I found the documentation here and here (under moveActiveEditor) for moving tabs, but I have trouble creating a key binding for it.
I created the following (for a Mac, so it uses cmd):
[
{
"key": "alt+cmd+right",
"command": "moveActiveEditor",
"args": {
"to": "position",
"value": i + 1
}
}
]
But when I hit that key command, the tab moves to the first tab position instead of moving one tab position to the right. So clearly, the value of i is 0, meaning it isn't returning the correct value of the current tab.
How can I get this to work?

You need to replace position with right and remove the value attribute:
[
{
"key": "alt+cmd+right",
"command": "moveActiveEditor",
"args": {
"to": "right"
}
}
]

Related

How to update the pop-up note via API

I'm trying to update the pop-up note via the API. I can easily update the top box (aka the Note) but I don't see how I go about updating the pop-up section. What's odd to me is that the Note doesn't even appear in the WSE, abut when I send the update it does work.
When I retrieve the record, it also doesn't appear to send the data that I have in the pop-up section, and I'm not even clear how I can add it to the WSE.
I've tried just adding it to the JSON update with a couple different names like this (tried popupnote, notepopup), and that still goes through, but only updates the top box:
"note": {
"value": "Travis Update Test!"
},
"notepopup": {
"value": "Travis Pop update Test!"
},
Anyone know if this is possible?
The answer from Acumatica Support is below. In short you need to add a custom field in the items sectionm for the 2 notes and it works perfectly. When loading the items, if you plan to serialize into this class, add this ?$custom=Item.NoteText,Item.NotePopupText to the end of your url:
{
"id": "2a113b2c-d87f-e411-beca-00b56d0561c2",
"custom": {
"Item": {
"NoteText": {
"type": "CustomStringField",
"value": "Regular note 2"
},
"NotePopupText": {
"type": "CustomStringField",
"value": "Popup note 2"
}
}
}
}

VS Code jump x lines up/down in any window/menu

In VS Code, is there a way to move the cursor x lines up/down in the currently active window or menu? I found a great post showing how it can be done for the text editor window (Microsoft VS Code - Jump 10 lines vertically at once),
{
"key": "ctrl+up",
"command": "cursorMove",
"args": {
"to": "up",
"by": "line",
"value": 10
},
"when": "editorTextFocus"
},
{
"key": "ctrl+down",
"command": "cursorMove",
"args": {
"to": "down",
"by": "line",
"value": 10
},
"when": "editorTextFocus"
},
but I'm trying to get it to work for any window or menu that is currently active, to make navigating with only the keyboard a little faster, such as in the Explorer window (Ctrl + Shift + E), in the Breadcrumb menu (Ctrl + Shift + .) or in the Quick Open menu (Ctrl + P).
Looking at the VS Code keybindings webpage (https://code.visualstudio.com/docs/getstarted/keybindings), under the 'when' clause contexts section it states "If your key binding doesn't have a when clause, the key binding is globally available at all times.", but when removing the when clause from the custom keybinding, it unfortunately still only seems to work in the text editor window, and not in any other window or menu.

Vega mark vs view mouseout events

I'm trying to write a Vega signal that stores data when you mouseover a particular mark, and then resets when you mouseout from the entire view.
I tried the following:
{
"name": "mysignal",
"on": [
{
"events": {
"source": "scope",
"type": "mouseover",
"markname": "layer_0_layer_0_marks"
},
"update": "datum"
},
{"events": {"source": "view", "type": "mouseout"}, "update": "null"}
]
}
But when you mouseout of the mark specified the signal gets set back to null, even though I didn't mouseout of the entire view. I have a full spec in the editor link below so you can observe the behaviour I'm talking about. My question is: Is there a way to prevent the signal from being set to null on mouseout from the mark, so that it only gets reset on mouseout from the whole view.
Open the Chart in the Vega Editor

How do i select the e.g. first entry in a dropdown list which is created when typing in characters?

I'm testing the chrome extension "Kantu browser automation" and could use some help in figuring out how to select from a drop down list, when the drop down list is created based upon typed characters.
The website I'm testing on is https://uddannelsesstatistik.dk/Pages/dagtilbud_institutioner.aspx
I've tried to record my way through with no success.
I've tried to use click, but can't select the dropdown-list, since it disappears when attempting to clicking on it.
I've tried ClickAt with Coordinates 262,504 and other coordinates as well. Nothing happens.
{
"Name": "Uddannelsesstatistik - Dagtilbud",
"CreationDate": "2019-2-11",
"Commands": [
{
"Command": "open",
"Target": "https://uddannelsesstatistik.dk/Pages/dagtilbud_institutioner.aspx",
"Value": ""
},
{
"Command": "type",
"Target": "id=dawa-autocomplete-input",
"Value": "Aabakken 1, Rebæk, 6000 Kolding"
},
{
"Command": "clickAt",
"Target": "id=dawa-autocomplete-input",
"Value": "262,504"
}
]
}
Right now, it stops when the characters is typed.
The expected output would be that i typed in e.g. "Aabakken 1" and then select the first entry in drop down list "Aabakken 1, Rebæk, 6000 Kolding".
I'm not that experienced in reading html code and how to specify to select first element in a html list, so i could really use all the references, examples, and all help in general.
I have never used kantu before, but you can use the below xpath to identify the first element of the auto completion drop down and you can click on it.
//input[#id='dawa-autocomplete-input']/preceding::label/following::div[1]/ul/li[1]
Give some(at least 3 seconds) delay before performing click action using the above xpath otherwise you will get an error.
I hope it helps...

Sublime 3 - Set Key map for function Goto Definition

I want to create an Eclipse style shortcut Ctrl+MouseClick to open the function/method. Sublime Text 3 has already this function called goto_definition but it is bound to F12.
But I'm not sure how to create this binding. I looked here for documentation but it was too complex. Can you one help me out with this simple key binding?
Edit: Following this article I was told to do this: http://webtempest.com/better-definition-navigation-in-sublime-text-3/
[
{
"button": "button1",
"count": 1,
"modifiers": ["super", "shift"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
This doesn't seem to work, ctrl+shift+click executes nothing.
For anyone else who wants to set Eclipse style goto definition, you need to create .sublime-mousemap file in Sublime User folder.
Windows - create Default (Windows).sublime-mousemap in %appdata%\Sublime Text 3\Packages\User
Linux - create Default (Linux).sublime-mousemap in ~/.config/sublime-text-3/Packages/User
Mac - create Default (OSX).sublime-mousemap in ~/Library/Application Support/Sublime Text 3/Packages/User
Now open that file and put the following configuration inside
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
You can change modifiers key as you like.
Since Ctrl-button1 on Windows and Linux is used for multiple selections, adding a second modifier key like Alt might be a good idea if you want to use both features:
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl", "alt"],
"press_command": "drag_select",
"command": "goto_definition"
}
]
Alternatively, you could use the right mouse button (button2) with Ctrl alone, and not interfere with any built-in functions.
To set go to definition to alt + d. From the Menu Preferences > Key Bindings-User. And then add the following JSON.
[
{ "keys": ["alt+d"], "command": "goto_definition" }
]
If you want to see how to do a proper definition go into Sublime Text->Preferences->Key Bindings - Default and search for the command you want to override.
{ "keys": ["f12"], "command": "goto_definition" },
{ "keys": ["super+alt+down"], "command": "goto_definition" }
Those are two that show in my Default.
On Mac I copied the second to override.
in Sublime Text -> Preferences -> Key Bindings - User I added this
/* Beginning of File */
[
{
"keys": ["super+shift+i"], "command": "goto_definition"
}
]
/* End of File */
This binds it to the Command + Shift + 1 combination on mac.
On a mac you have to set keybinding yourself. Simply go to
Sublime --> Preference --> Key Binding - User
and input the following:
{ "keys": ["shift+command+m"], "command": "goto_definition" }
This will enable keybinding of Shift + Command + M to enable goto definition. You can set the keybinding to anything you would like of course.
ctrl != super on windows and linux machines.
If the F12 version of "Goto Definition" produces results of several files, the "ctrl + shift + click" version might not work well. I found that bug when viewing golang project with GoSublime package.
I'm using Sublime portable version (for Windows) and this (placing the mousemap in SublimeText\Packages\User folder) did not work for me.
I had to place the mousemap file in SublimeText\Data\Packages\User folder to get it to work where SublimeText is the installation directory for my portable version. Data\Packages\User is where I found the keymap file as well.
One should not just configure the goto_definition shortcut -- you would also need a shortcut to go back(and forth) after you jump to the definition.
Hence, consider configuring all three shortcuts: goto_definition, jump_back, and jump_forward as follows in your Key Bindings config file :
// go to the definition
{ "keys": ["ctrl+i"], "command": "goto_definition" },
// go back to the previous location
{ "keys": ["ctrl+h"], "command": "jump_back" },
// go to the next location
{ "keys": ["ctrl+l"], "command": "jump_forward" },
I find these three commands especially useful while trying to read code quickly.