Is there a way to enable camel humping through method names in VS Code? - keyboard-shortcuts

As this question is for the "big" Visual Studio and Resharper, I'd like to see that feature in VS Code too.
Scrolling through the shortcut list for VS Code, I couldn't find it but I'm hoping that it's still there but called something less intuitive than camel, hump or such.

As of version 1.25 these commands are built in:

I found this extensions to work https://marketplace.visualstudio.com/items?itemName=ow.vscode-subword-navigation
Funny thing is that you need to configure each combination separately:
{
"key": "alt+left",
"command": "subwordNavigation.cursorSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+right",
"command": "subwordNavigation.cursorSubwordRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+left",
"command": "subwordNavigation.cursorSubwordLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+right",
"command": "subwordNavigation.cursorSubwordRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+backspace",
"command": "subwordNavigation.deleteSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+delete",
"command": "subwordNavigation.deleteSubwordRight",
"when": "editorTextFocus"
}

If for some reasons your bindings are not set here is the json to obtain Cezn's shortcuts.
{
"key": "ctrl+alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+right",
"command": "cursorWordPartRightSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+left",
"command": "cursorWordPartLeftSelection",
"when": "editorTextFocus"
}
{
"key": "ctrl+alt+backspace",
"command": "deleteWordPartLeft",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+delete",
"command": "deleteWordPartRight",
"when": "editorTextFocus && !editorReadonly"
}
Be careful with the ctrl+alt+delete one since it conflicts with another popular windows shortcut.
Other interesting bindings are:
{
"key": "ctrl+n",
"command": "explorer.newFile",
"when": "explorerViewletFocus"
},
{
"key": "ctrl+shift+n",
"command": "explorer.newFolder",
"when": "explorerViewletFocus"
}

There is an extension for this: Camel Case Navigation

Related

submenu on context menuitem in 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

How can I achive that enable all checkboxes in jsonschema after I check radio button?

Okey. I have a jsonschema as below. I am trying to get all the items (colors - checkboxes) clicked by default when the radio button "YES" is marked. On the contrary, if the "NO" button is clicked, all the colors will be unchecked.
JsonSchema
{
"title": "Item Type Filtering Form",
"description": "Form for filtering Item Types according to selected Attribute Values.",
"type": "object",
"properties": {
"colorAll": {
"type": "boolean",
"title": "Seat Color All",
"enum": [
false,
true
],
"enumNames": [
"NO",
"YES"
],
"default": true
},
"colorList": {
"type": "array",
"title": "Seat Color",
"items": {
"type": "object",
"enum": [
{
"id": 1,
"label": "RED"
},
{
"id": 2,
"label": "BLUE"
},
{
"id": 3,
"label": "GREEN"
}
],
"enumNames": [
"RED",
"BLUE",
"GREEN"
]
},
"uniqueItems": true
}
}
}
UISchema
{
"colorAll": {
"ui:widget": "radio",
"ui:options": {
"inline": true
}
},
"colorList": {
"ui:widget": "checkboxes",
"ui:options": {
"inline": true
}
}
}
I am practising it on the page https://mozilla-services.github.io/react-jsonschema-form/# but none of my tries is working how I described above...
I thought, that I can make it with "default:" keyword and put all the values into it -> JsonSchema is valided, but it didn't work.
Can somebody help me with it?
Currently It does not seems to be possible
{
"title": "Schema dependencies",
"description": "These samples are best viewed without live validation.",
"type": "object",
"properties": {
"conditional": {
"title": "Conditional",
"$ref": "#/definitions/person"
}
},
"definitions": {
"person": {
"title": "Person",
"type": "object",
"properties": {
"colorAll": {
"type": "string",
"enum": [
"No",
"Yes"
],
"default": "No"
}
},
"required": [
"colorAll"
],
"dependencies": {
"colorAll": {
"oneOf": [
{
"properties": {
"colorAll": {
"enum": [
"Yes"
]
},
"colorList": {
"type": "array",
"title": "Seat Color",
"items": {
"type": "string",
"enum": [
"RED",
"BLUE",
"GREEN",
"Yes Only",
"ABC"
]
},
"default": [
"RED",
"BLUE",
"Yes Only"
],
"uniqueItems": true
}
}
},
{
"properties": {
"colorAll": {
"enum": [
"No"
]
},
"colorList": {
"type": "array",
"title": "Seat Color",
"items": {
"type": "string",
"enum": [
"RED",
"BLUE",
"GREEN"
]
},
"uniqueItems": true
}
}
}
]
}
}
}
}
}
if you run the above in playground, the list of colors changes, but it does not select the default ones. but if you have colorList has standalone component, it selects the default ones.
To change the default selected values, you need to use the "onChange" property of the form (https://react-jsonschema-form.readthedocs.io/en/latest/#form-data-changes) and handle that logic on your own. Thus, you can check if the radio button was toggled to true or false, and if so, set colorList to
[
{
"id": 1,
"label": "RED"
},
{
"id": 2,
"label": "BLUE"
},
{
"id": 3,
"label": "GREEN"
}
]
or [] respectively.
Note the following warning in the doc:
WARNING: If you have situations where your parent component can re-render, make sure you listen to the onChange event and update the data you pass to the formData attribute.
Here's an example codepen I set up that manages the two properties:
https://codepen.io/anon/pen/VOjJmY
Also note that because the actual value is an object, I think you have to reuse the same object (hence the direct use of schema.properties.colorList.items.enum).
I think there is a bug with React JSON Schema Form because the checkboxes' UI state doesn't get updated in the right lifecycle or something. The state is correctly updated, but I can't the un-toggle all/toggle all effect to happen on correct state, but rather the follow toggle... Like on going from "YES" -> "NO" -> "YES" they all switch off, and then going from "YES" -> "NO" they would switch back on...

Sublime 3 toggle comment command doesn't work in Windows

I've edited the file Preferences > Key Bindings User, and added this:
[
{ "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } },
]
But the shortcuts doesn't work. What went wrong?
I solved my problem:
[
{ "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },
]
Just replace '/' by 'keypad_divide'
This works for me, with a QWERTY (Italian) keyboard, where the / is above the number 7.
Add in Preferences > Key Bindings User
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
It should works good on German QWERTZ keyboard also.
This worked for me on Windows 10:
{ "keys": ["control+keypad_divide"],"command": "toggle_comment", "args": {"block": false} },
{ "keys": ["shift+control+keypad_divide"],"command": "toggle_comment", "args": {"block": true}}
I was having the same problem, but what worked for me was
ctrl + รง
without going to preferences.
(I have no idea why, notice is the c cedilla)
With portuguese keyboard layout (my case) I had to use this:
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
The solution for italian keyboards also works for spanish keyboards on Windows 10:
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
Follows this link for the solution:
Keyboard shorcut to Toggle (Block) comment in Sublime-Text
Few additional comments:
Also, as a good practice try to edit the Default (Windows).sublime-keymap -User file to place your personal preferences
If the symbol still doesn't works for you, possibly due to different keyboard layout, then can change opt for other key as well for e.g.
"keys": ["ctrl+shift+#"] ...
in the Default (Windows).sublime-keymap -User file.
This one work for me under window 10
{ "keys": ["ctrl+'"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+'"], "command": "toggle_comment", "args": { "block": true } }
[
{ "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },
]
keypad_divide just solve my problem
This has solved the issue for me, without having to add an alternate keyboard shortcut:
{ "keys": ["ctrl+'"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+'"], "command": "toggle_comment", "args": { "block": true } }
I don't quite understand why. This key undoubtedly types a slash(/) but SublimeText interprets it as an apostrophe(') in the key binding.

How to make the suggestions menu appear automatically for all kind of files?

I would like to have an automatic drop down menu with the suggestions of possible words whenever I write something, but not when I am in Javascript, HTML or CSS mode (it already pops up automatically), but in a plain text file.
Is that possible to do?
I have tried to look at the settings file, but I have not found how to do it.
Usually I have to press Ctrl + Space, and a pop up menus appears with some suggestions based on what you have typed so far (I guess).
VSCode doesn't currently support this. However, you can workaround using the following rules in your keybindings.json:
File > Preferences > Keyboard Shortcuts
[
{ "key": "a", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "b", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "c", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "d", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "e", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "f", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "g", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "h", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "i", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "j", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "k", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "l", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "m", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "n", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "o", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "p", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "q", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "r", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "s", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "t", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "u", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "v", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "w", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "x", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "y", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" },
{ "key": "z", "command": "^editor.action.triggerSuggest", "when": "editorTextFocus" }
]

Is there a shorcut to jump to another layout in sublime text3?

We can make a view with two layouts columns in sublime text 3. And when I want to type in another layout I always click to this layout so I don't want to click. I want to use shortcut. Is there such a shortcut?
The short answer to your question is super+k super+left and super+k super+right
Here are the shortcuts directly from Default keybidings.
If you're on Window super in Control key and if you're on Mac super is Command
{ "keys": ["super+k", "super+up"], "command": "new_pane" },
{ "keys": ["super+k", "super+shift+up"], "command": "new_pane", "args": {"move": false} },
{ "keys": ["super+k", "super+down"], "command": "close_pane" },
{ "keys": ["super+k", "super+left"], "command": "focus_neighboring_group", "args": {"forward": false} },
{ "keys": ["super+k", "super+right"], "command": "focus_neighboring_group" },
{ "keys": ["super+k", "super+shift+left"], "command": "move_to_neighboring_group", "args": {"forward": false} },
{ "keys": ["super+k", "super+shift+right"], "command": "move_to_neighboring_group" },