I'm not sure what happened but the default behavior that I've grown accustomed to has stopped working in regards to foreach followed by TAB.
For example. I type the word foreach. I press TAB. I see this:
The first template region is the box with COLLECTION in it. Normally I start typing the collection name. When I'm done I type TAB then set the VARIABLE name. etc.
What I actually get is buggy.
For example, after I type in the collection name:
I press TAB again.
Expected: it moves over to VARIABLE so that I can provide a name.
Actual: it doesn't move over, and it deletes the closing parenthesis and moves the brace, like this:
Does anyone know how to get the normal behavior restored?
Note: I do NOT want to restore defaults. That will wipe out dozens of other fine-grained format settings that I have configured.
Maybe you have some other extensions that are interfering with Resharper.
See this link for more details:
Speeding up ReSharper (and Visual Studio)
The answer is simple: restart visual studio.
For some reason resharper stops responding to normal commands and fixed itself simply by restarting the IDE.
In in development experience, strange thing I am finding having a PC in a Bank and 3 times it has got errors and changed, and now I am finding issues in VS editors, that for example, short cuts like CTRL KU for uncommenting, and commenting multiple lines together doesn't work properly and my fast typing hands using such short cuts find it difficult to perform activities.
Also, I couldn't do "Undo" of code changes which is very very scary as I used to do a lot of code changes and save and run and again I used to successfully undo everything even though its saved. But I am finding these all not happening in this PC/organization for VS.
I tried googling out for any settings to enable for these features, but futile, as I see not much settings on these found. Could someone please help me out?
Under visual studio
GO to the Tools> Options
A window will pop up. Under Environment choose keyboard.
Make sure visual C# 2005 is selected.
For Comment/Uncomment in your xml file. Make Sure following settings are present there
You might have noticed that "Use New shortcut in" is "Global". In your case it might be something else.
Do the same for Edit.commentselection
I am using Visual Studio and Resharper 8.
For some reasons, my favorite shortcut Ctrl+K, Ctrl+C or Ctrl+D no longer works.
Indeed, the application shows in the status bar the message: The key combination is(Ctrl K Ctrl C ) is not a command.
Any ideas how to reset them?
Many thanks.
Very strange problem. Yes, it is possible to edit the command in Visual Studio. Select Tools and then Options. Once the window is shown, select the Environment option group and then Keyboard, as shown in the picture below:
There, you can edit the shortcuts:
Edit.CommentSelection for commenting a selection (Default shortcut: Ctrl+K, Ctrl+C)
Edit.FormatDocument to format the document (Default shortcut: Ctrl+K, Ctrl+D)
I have had this issue off and on myself in different versions of VS (now VS 2017). I just figured out that it is a combination of two keys to comment and uncomment code in VS.
To comment code: Press Ctrl+K, then also press C while still holding the Ctrl key.
To uncomment code: Press Ctrl+K, then also press U while still holding the Ctrl key.
You can release the Ctrl key after pressing K, then press Ctrl+C (or Ctrl+U to uncomment), but is just easier to press the keys in succession.
I had never noticed the status bar at the bottom of the window stating it was waiting on the second key press (C or U).
Sorry to resurrect a old thread like this but I have had issues with chording since this whole WFH/Covid-19 thing started. When it first happened the only thing that worked was to reinstall VS 2019. It happened again and this time I reset the keyboard setting back to default and it fixed it with out having to reinstall VS2019. It happened again today. Resetting keyboard settings didn't work and I was not in the mood to re-install so I was living with it for a while. It was after I took a lunch break that I noticed that a light on the top right of my keyboard, which is usually on, was off. It's the light for scroll lock. I hit the scroll lock key, the light came back on my keyboard and suddenly all my short cuts were back.
May not be the answer for everyone but if it's intermittent like mine was, it may be this ridiculous key that I have apparently never hit at work...
Visual Studio 2019 here, not using Resharper - CTRL + K, CTRL + C "stopped working".
In my case, the solution was simple.
While editing your files, make sure that you are in the Solution View, not the Folder View.
I also has this issue and found this post, but then realised that ctrl-K wasn't working if code already has a comment within it, Not this is specifically when trying to make a comment in a razor view where there are html comment <!-- --> within the code that needs commenting. This is odd and the first time I have encounter this since the first version of VS.
The solution here is to delete or uncomment that code first.
Faced this issue with Resharper enabled just a few minutes ago in VS2019.
All I had to do was to reset the mappings. No restart required. (Warning : that will reset all your manually added mappings to its default values)
Tools --> Options
Had the same problem with Format.
Follow the directions in the previous post - if Ctrl+K already appears under Edit.FormatDocument, click on Remove and then define it again as Ctrl+K. A warning will come up saying command Ctrl+K was used to clear bookmarks. This may be the root cause, as Ctrl+K is defined in multiple places by default. Once I redefined it, it worked properly.
Select Tools and then Options.Then select the Environment > Keyboard.
In the Keyboard section click Reset.
'Ctrl+K' following with C for comment and U for uncomment while holding Ctrl works. However to simplify and unify the keyboard shortcut to what you are used to you can just change the mapping scheme to something else like VSCode:
'Tools>Options>Environment>Keyboard'
Be sure that you saved the file with .py extension. Otherwise, the software does not perceive the code as command lines and thus does not transfer the lines to comments
Coming from Eclipse and now working in Visual Studio I was trying to assign my hotkey bindings to the same ones I used to have in Eclipse. I have Resharper installed, too.
I've assigned Ctrl+T to "Type Hierarchy" but it still seems to respond as it did just before : it expects me to press another key, as Ctrl+T is being identified as a combo.
Is there any way to accomplish this?
First off, if you're so used to Ctrl+T, at least set it to invoke "Inspect This" (ReSharper.ReSharper_InspectThis in VS options), which brings up a drop-down letting you choose between Type Hierarchy, Call and Value Tracking.
As to shortcut assignment, I'm guessing that you have IntelliJ keymap set up in ReSharper. If that's the case, in order to have Ctrl+T reassigned, you'll have to ruin the entire range of ReSharper's unit testing shortcuts:
If you switch to VS keymap (ReSharper > Options > Environment > Keyboard & Menus > Visual Studio > Apply scheme), it gets substantially better as in all contexts (except for XAML UI Designer for some reason) VS won't expect Ctrl+T to be a part of a combo:
You'll still have to transfer a fundamental ReSharper shortcut which is Go To Type to another shortcut but this is less pain than killing the entire unit testing subsystem.
Last but not least, if you're going to stay with Visual Studio for long, try force yourself to use any of the two standard ReSharper keymaps. ReSharper documentation and ReSharper users talk shortcuts, which sets you up for a hard time learning and communicating.
Recently, probably by some accidental key-combination stroke during furious development, my IntelliSense window has a small text input field above which is really annoying, because I can no longer just type and hit Enter to use the autocompletion feature.
How do I get rid of it?
The key combination you probably pressed was Ctrl + Alt + Space, which toggles the completion methods of intellisense.
Can be switched back to the other completion mode by going to:
Edit-> Intellisense -> Toggle Completion Mode.
this seems like a bug in VS, please see below
http://connect.microsoft.com/VisualStudio/feedback/details/587691/vs2010-bug-intellisense-shows-empty-text-field-and-stops-working-correctly
and this bug is closed as "Not Reproducable"...
did you try restarting the VS? propbably, that should fix your problem.
If yes, can you try restarting the machine?