How do I move through intellisense suggestions with a keyboard shortcut? - visual-studio

When I write something like Console. I get suggestions like Console.Write and Console.WriteLine. I don't want to use the arrow keys, they are too far away, how do create a shortcut for that? I would prefer something like shift+o for moving up and shift+k for moving down.

Try TouchCursor, it lets you use the home keys as cursor key
TouchCursor

You can always remap the keyboard shortcuts to do what you want. See my answer here: https://stackoverflow.com/a/18744507/958809

I don't if there is an alternative for navigating one by one but you can use the first letters of every word to quickly find what you are looking for.
Typing Console.wl will quickly bring up Console.WriteLine. It's available by ReSharper I think.
You don't even have to type the first letters by the order. Typing avl can bring up SomeMethodWithAVeryLongName.

I don't know solutions within Visual Studio and ReSharper.
But maybe a remapping of keyboard keys can help, i.e. remap Caps Look key to Arrow Down key. See http://www.askdrtech.com/solutions/post/How-to-change-keyboard-mapping.aspx for explanation.

I think your problem is just this: Ctrl + Alt + Space

In VS Code, go to File > Preferences > Keyboard Shortcuts
Search for suggest select in the search bar
the ones you want to change are selectNextSuggestion and selectPrevSuggestion. I mapped mine to TAB and shift + TAB, respectively, to free my arrow keys.
There's plenty of cool stuff you can customize for Intelisense. Check the documentation page: https://code.visualstudio.com/docs/editor/intellisense

Related

Mac OS option key shortcuts not working, how to make it work?

I have a very long line which I want to view as wrapped.
There is an option called word wrap that can help me achieve this.
Anyhow the shortcut method option + z doesn't work, instead inserts a ˀ there.
Any solutions?
Looks like one of your extension might be overriding your VSCode config. Try ⌘+SHIFT+P/CMD+SHIFT+P and then search for View: Toggle Word Wrap/Toggle Word Wrap.
You will then be able to see the shortcut assigned to that command on your local PC. Alternatively, ⌘+SHIFT+P/CMD+SHIFT+P and search for Keyboard Shortcuts. In there search for OPTION+z and check for the answers which pop up.

How to stop using the arrow keys in Visual Studio Code

When I am using letter keys and move to arrow keys it's a waste of my time. For that, I use vim in vscode but problem is that I don't use h,j,k,l, etc letter when type. For example: when I type "j" my cursor down but I don't type the letter "j" ..how can I solve the problem?
you can give a try to touchcursor-linux. It basically provides arrow keys and other button functionalities by making space button work as shift. I think it's really intutive and easy....and you don't have to switch to vim keyboard layout as well.

What is the keyboard shortcut to type fast in Visual Studio?

I am not sure what is the best way to word my question correctly in single line. But basically I have seen quite a few video tutorials now where the coder types really fast using some sort of shortcut to fill in the automatic text(prolly intellisense stuff) It looks very similar to Linux command line tab where you only type half of your text and when you hit tab it either fills in the gap or show you the remaining options.
Hope that makes sense.
Thanks
Pressing Ctrl+Space completes the current variable/class you are typing.
Typing things like ctor and then pressing the Tab key twice tells Visual Studio to insert a constructor for you. (Also works with for for a for loop, cw for a Console.WriteLine();, etc.)
For a full list, please refer to the official reference from MSDN.
I believe its Ctrl-Space, which is pretty common among most IDE's

How to navigate back to the last cursor position in Visual Studio?

What is the keyboard shortcut navigate back to the last cursor position in Visual Studio?
It Will not work for red color (-) key. For me it only works for blue color combination.
According to Visual C# 2008 Keybinding Reference Poster it is Ctrl + -. The name of the specific keybinding is View.NavigateBackward.
PS: While researching I also found that Ctrl + . is the same as Shift + Alt + F10. Nice!
ctrl + - (dash) navigates backward.
ctrl + shift + - (dash) navigates forward.
These settings can be found under Environment -> Keyboard:
For Changing the setting in Visual Studio 2019:
Search for view.navigate
CHOOSE "Text Editor" from the "Use new shortcut in:" drop down menu
Select your shortcut
Global doesn't catch for this.
For new VS Code(1.28.2)
Back: Ctrl+Alt+- (dash)
Forward: Ctrl+Shift+- (dash)
The most generic answers is: there is no working default and you need to define your own keyboard shortcuts for View.NavigateBackward and View.NavigateForward.
Why? For most keyboards, the default shortcut is a broken, unusuable combination because VS badly handles the shift and altGr modifiers. MS did not pay attention to portability and internationalisation so much when they redeveloped VS after version 6, and this is still true today. This bug has been there for way more than a decade, nearly two decades. At this rate, it will never be fixed. And yes, I have filled a bug report, and I'm certainly not the only one.
However, their "VSCode" product line does have better keyboard handling as it doesn't depend on the shift or altGr modifiers to identify the key. For example, when you are in text writing mode and press the key that has the dash symbol, without using shift nor altGr, let's say it writes something else, like number 6. To VSCode when it comes to shortcut handling, that's still the dash key for its purpose. As long as a key has the symbol written on it, whether this is painted as the 1st, 2nd or 3rd level doesn't matter, it just that key.
Of course, it's never a good thing to make the default shortcuts use non-alphanumeric symbols, that's always confusing, whether it works or not. The good mature text editors have known that for a long time and should be taken as examples of things done right. In some ways, VS learned a few good things from emacs with shortcuts that are a sequence of two letters, but ultimately screwed up on other parts with the choice of non-alphanumeric bindings, combined with a broken low-level keyboard handling.
This works for me in Visual Code
Navigate backward Alt+←
Navigate forward Alt+→

"Greedy" <Delete> and <Backspace> in Visual Studio

Is there the way to apply "greedy" behavior to and keys in Visual Studio? By "greedy" I mean such behavior when all whitespace between cursor position and next word bound can be deleted using one keystroke.
Well, I don't think you can change the binding of the delete key or backspace key - but CTRL+DEL & CTRL+Backspace are pretty close to what you want.
You can use Ctrl+Shift+Arrow keys to make the selection and then just hit Delete. You may need to hit the arrow key more than once while still pressing Ctrl+Shift combination but because the fingers are in the same position is very fast. This works also for selecting words incrementally.
Actually, you will need to do this: Ctrl+Shift+Left+Right - this will give you only the space selected, and then you can press delete.
This is assuming that you are coming from the right, and you have to delete the space to the left.
Of course, this is still 5 keystrokes... but it beats pressing backspace again and again....
Just Ctrl+Backspace...
Ctrl+Back Space and Ctrl+Delete are also greedy, they delete the nearest word in their respective direction.
You are looking for:
Edit.DeleteHorizontalWhiteSpace
I have it set to Ctrl+K, Ctrl+\ which I think is the default, but might not be
Sounds like something you could write a macro for and then assign to a keyboard shortcut (like SHIFT+DEL).
If you explore the EnvDTE namespaces you can do a lot to make changes to text in the active document window. I'd start by checking with something like...
Public Sub RemoveWhiteSpace()
DTE.ActiveDocument.Selection.WordRight(True)
DTE.ActiveDocument.Selection.Text = " "
End Sub
That's just a simple example, but you can extend it further pretty easily
As of recent, ReSharper has this as an option. It's on by default, which led to this Q&A: Visual Studio recent "hungry" or "greedy" backspace behavior update?
Perhaps this doesn't qualify as applying the behavior directly in Visual Studio, but it's good to know about.
OK I've got this < Ctrl > thing. And applying this knowledge I've found corresponding VS commands: Edit.WordDeleteToStart and Edit.WordDeleteToEnd.
I've successfully remapped < Delete > and < Backspace > keys using Options->Environment->Keyboard dialog. Unfortunately this commands apply not only to whitespace as I'd wish to, but still, thanks everyone!

Resources