How do I fix this Visual Studio keyboard mapping problem? - visual-studio

Something (who knows, possibly even me, though certainly not intentionally) has changed the keyboard mapping in Visual Studio 2008, and I cannot figure out how to get it back to the default.
The symptom that I see as the problem is that when I type the name of a class which is not in a namespace listed in the using statements at the top of the file, the shortcut to add that namespace to the file (expand tooltip), which is, by default, Ctrl + . (period) has been changed to Shift + Alt + F10. There are probably other key settings changed, but this is one that is really annoying me at the moment.
Ways I have already tried to fix the problem which have not worked
Tools, Options, Environment, Keyboard, press Reset button. (The additional mapping scheme is set to Default, but I have also tried VC #2005; neither fixed the problem.)
Tools, Import and Export Settings, re-import C# developer settings
devenv /reset
Using "repair" from the installer.
I know that I could probably fix just this one key binding by customizing it, but I don't want to do that. I want to reset all of the key binding spec to their default settings.

I figured out the problem: Ctrl + . was remapped by FSI when I installed F#. That's why resetting the key mappings didn't fix the issue: I still had F#. And the answer to which other mappings I've lost is, "Those mapped by FSI" (type FSI in keyboard mappings; there are only two).

I came across the same problem, (Tools-Options->Keyboard) View.ShowSmartTag is the field where you can re-assign the shortcut manually to Ctrl + .
I know it's a few months post date, but that should do the trick.

Do you have a "working" visual studio around? You can export the setting (keyboard only settings) from that machine and import it into your machine.

In the default Visual Studio 2008 C# key bindings, both Ctrl + . and Shift + Alt + F10 map to Show Smart Tag.
You can download Visual C# 2008 Keybinding Reference Poster here.

something that happen to me ...
make sure that "F lock" key on the keyboard (if you one of this) is on.. i didn't sew that i turn it off, and nothing work normal. (F5 - open the open dialog, F10 switch to split mode!)

Did you do something like install ReSharper?
If you did, you can fix this by going through your options for Visual Studio and/or the options for ReSharper (Can't remember now) and simply setting them up to continue using Visual Studio Layouts as opposed to that of the Add-in.

Related

F12 finds all references, not go to definition

Lately my F12 key does not seem to be working as expected in Visual Studio 2010 Professional SP1. It should go to the definition of what is selected, but instead it's performing the find all references task - Ctrl+K, R.
Does anyone have any ideas how I can fix this? It is getting quite annoying as I routinely use this shortcut - I am working on a large solution where it sometimes locks visual studio briefly trying to find all references.
I have tried going to Tools -> Options -> Enviroment -> Keyboard -> Reset with no success.
One other thing: it only does it sometimes and I am yet to distinguish a pattern when it does and does not work as expected.
Edit:
One thing I forgot to say is that when it does not work, the second time I press F12 it does take me to the definition, it's just the first press that finds all references.
You can set any keyboard shortcut to any command.
Type edit.gotodefinition to select the command and press F12 to assign the key.
like this
Maybe there is more than one definition for the class or function in your project?
I had this problem after copy/pasting a class definition. After pressing F12 on the class name, it first brought up a search result showing both files in which the class name was found. If you press F12 another time, it will jump to the first one in the search results.
Did you know that you can use Ctrl + - (Minus) to jump back? :-)
I experienced this exact misbehavior today with VC++ 2013: pressing F12 was no longer jumping to a method's definition, but was instead showing a list of references to that method.
Turns out IntelliSense is required in order for the command Edit.GoToDefinition to work, which I had disabled this morning. Setting Tools>Options>Text editor>C/C++>Advanced>IntelliSense> Disable IntelliSense back to False fixed the problem.
Delete your SUO file before opening your project in Visual Studio. Unfortunately you have to do this every time before opening your project. This will also work when Visual Studio stopped regenerating the designer files.
I had the same issue where my F12 key was not working nor were any of my other Function keys. After spending some frustrating time Googling I found that my fancy keyboard had the function key locked! So check that too before try the Tools-> Options

Enter., Backspace and the navigation keys not responding in Visual Studio 2010 w/ Powertools/Resharper

I have this very annoying problem that in Razor Views the Enter, Backspace and the navigation keys frequently do not respond. I have to restart VS to get it back to normal again. Am I missing something?
I had the same problem and solved it by saving the razor file (Ctrl + S). Once I did this I could use the Enter, Backspace and Navigation keys again.
I believe that Alt + Enter may also work.
I don't often get into this state and the above solution does not solve the underlying problem. I believe that it may have something to do with ReSharper but have not figured out if this assumption is true or not.
There are a number of pages that discuss this type of problem:
Link 1
Link 2
Link 3
Please try deleting the hidden '.suo' config from the solution folder.
I know this thread was created some time ago, but this may be an useful tip for someone.
This was happening to me in VS 2010, despite not using R#. After digging through those links #Ryan Spears put in his post I have come across a permanent solution Source. (Note that #Maffelu's solution did work for me, but it can switch back if I accidentally hit Left Alt + Shift).
This is also weird because Left Alt + Shift doesn't seem to change it back, so you have to go to the source: a key binding buried in the Windows Control Panel:
Control Panel > Region and Language > Keyboards and Languages > Change Keyboards > Advanced Key Settings > Change Key Sequence > Select "Not Assigned" for both Switching Input Language and Switch Keyboard Layout.
I've seen the same in Visual Studio 2013 and 2015 CTP.
None of the above solutions worked, but restarting Visual Studio did (after displaying the below warning).
I don't use ReSharper and this still happened. Pressing Control + Tab twice worked for me.
Something that worked for me:
Try Tools > Import and Export Settings... then only select Keyboard.
Search for Bkspce and see if it is being used for anything.
I accidentally had something Global bound to Bkspce, Bkspce which caused a very strange problem.
This happened to me when I installed ReSharper to a Visual Studio that has VsVim installed, and I fixed it by doing the following:
Uninstall VsVim
Reset the keyboard mapping to default in Tools -> Options -> Environment -> Keyboard
Set the ReSharper keyboard shortcut mapping in ReSharper options. (I use ReSharper 2.x or IntelliJ IDEA), and make sure Enter, Backspace, etc work.
Install VsVim and configure its keyboard options.
This issue occurred for me (in VS 2019) after installing a visual studio extension. So try removing any recently installed extensions.
The extension I used was File Nesting.
Note: System reboot didn't fix the problem.
Resharper could be the reason.None of the solutions above worked for me.
First check if Resharper is the problem.
Simply navigate to Tools > Options > ReSharper > General > Click suspend Resharper.
After taking steps above, if it works now as expected,then your problem could be caused by cache.
Clear cache following by the navigation below.
Resharper > Options > General > Clear caches or erase them manually
Or problem can be caused by not matching script tags in the cshtml.(Weird but it was the case that causes my problem)
If you have too many files open in Visual Studio 2010 then Enter or Backspace key will stop working intermittently. Try closing some files and Enter and Backspace key will start working.

alt+ctrl+f4 not working on visual studio 2005? but it did work previously

In VisualStudio .net (say 2005)
I have this shortcut Alt+Ctrl+F4 which closes all the opened windows. (Already mapped to window.closealldocuments)
and another one Alt+Ctrl+Shift+F4 to close all but this window.
Now both shortcuts used to work on my previous workstation.
Both having winxp 32.And i work on sv 2005 on both.
But on this new machine, Alt+Ctrl+F4 does not seem to propagate to Visual studio, like there's some other application or the explorer mapping this key to something else, and it's not propagating the event to vs process.
I know about the 'tools -> options...keyboard' in VS, but when I press the combination in the 'press shortcut keys:' field..
it would receive these combinations: Alt+Ctrl+F5->F10 but won't receive these: Alt+Ctrl+F1->F4.
It's like you didn't press nothing.
So now... any ideas?
the problem was a process that probably was receiving the key combination and not propagating it to the rest of applications.
in my case it was hkcmd.exe (intel's graphic something ) that captures key combinations to do certain things like display rotation and such.
anyway thanks hans passant for your comment.
These mappings aren't hard coded. Not sure what happened, but it is easy to remap them. Just go to Tools -> Options then:
Click in the top indicated text box, then press the key combination, and select the appropriate command for it. I like to use Ctrl + W to close the document and Ctrl + Shift + W for all.
You can set any hotkeys manually in any version of visual studio, just go to Tools->Options...-> Keyboard and assign any command to keys sequence

Navigate To (CTRL + comma) in Visual Studio does not work

The "Navigate To" function (CTRL + comma) does not work on my solution. It gets stuck on "Found 0 matching results" while the little progress bar stays there but is empty.
I searched for some kind of IntelliSense cache file next to the .sln, but all I found was a .suo file which I deleted but it did not help.
Why is it not working?
I had the same problem. I went to Tools > Options... > Environment > Keyboard and clicked Reset. Yes, it will reset any customizations you had, but I figured that was the problem for me (I had an add-in take over Ctrl-, and even when I disabled the add-in it wasn't working). Resetting the keyboard shortcut customizations did the trick.
The command is not "Navigate-To" but actually Edit-GotoAll and it has the keyboard shortcuts of Ctrl-T and the more known one of Ctrl-, (comma).
Reference Default keyboard shortcuts in Visual Studio
💡 Solution 💡
Here are the steps to resolve
Verify it is working by trying the opposite keyboard shortcut. If both shortcuts do not work type in "Edit Goto All" in the command search/execute box of Visual Studio.
Does the command work? If it does not work then do a reset via Visual Studio Options:
Then verify or add the keyboard command to the command in the mapping after the reset.
Type in "Edit.Goto" in the Window commands containing
Then selected Edit.Goto.All:
If you do not see the mapping (#3)
Add the keystroke in the box where bubble 4 is above and click Assign.
Set OK as shown on bubble step 5.
This is for Chinese user only. This is because of the Sogou Pinyin (搜狗输入法)occupy this shortcut system wide. And it won't release if you just uninstall it.
Go to here to disable it: Language->Advanced settings->Change language bar hot keys
Uninstall it is not working, you need disable that setting then uninstall it.
The Navigate To Feature does not use an on disk cache so that shouldn't be the issue.
The only thing I can think of that would cause this behavior is a bad Visual Studio install. I hate making this suggestion but have you tried repairing the install?
Tools > Options... > Environment > Keyboard and clicked Reset.That will work.If you installed the latest version/framework or re-sharper of visual studio then it may happens...
I just got the same problem and solve it by following the instruction I found here: http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/2bbab30e-3188-406b-b492-eabf8c2fbc0b/
For Chinese users, if you are using Sogou Pinyin, you can turn off Ctrl + Comma thru this.
Use spyxx_amd64.exe in this answer should work for most cases. https://stackoverflow.com/a/43645062/1179950
However, this didn't work for me... For my case, which is caused by language keyboard hotkey setting in Windows. By Sougou Pinyin though I have uninstalled it..
You can unset this in Control Panal (Windows 10):
Region&Language -> Advanced keyboard settings -> Language bar options ->Advanced Key settings panel
Unset all hotkeys you wont use!
For traditional Chinese users, you muse use the old version of new Cangjie.
Ctrl+Comma

Search stops working for "Entire Solution"

Somehow Visual Studio search has stopped working for me. Anytime I search "Entire Solution" for some text I get this result:
Find all "[Whatever I was searching for]", Subfolders, Find Results
1, "Entire Solution" No matching text found to look in. Find was
stopped in progress.
Why does it suddenly say "No files were found to look in"?
I've found a number of links on Google that say to press Ctrl + Break or Ctrl + Scroll Lock, but none of them seem to work for me.
I get that problem once in a while. One seemingly nonsensical solution I've found is to click inside the Find Results window (not the Output window). Once the blinking text cursor is visible, hit Ctrl+Break four or five times. This seems to "unblock" whatever causes the problem.
There are reports Ctrl + ScrLk may need to be used instead of Ctrl+Break . If these doesn't work then try Break alone.
Note from Codeguard: I have found an explanation and deterministic solution to this problem
Windows 7 Pro SP1 64-bit, Visual Studio 9.0.30729.1
Didn't Work:
Ctrl + Break
Ctrl + Scroll Lock
Restart of Visual Studio
Worked:
Break (in Find Result 1 & 2) (only pressed once)
Source: Comments in Gordon's link...
Bug source
This is neither Visual Studio nor Windows related bug. In fact, the bug is in your keyboard! Many keyboards from different vendors have been reported to be buggy.
Problem
If you press Ctrl+Break and release Ctrl first, then Break gets stuck on a buggy keyboard. If you ever pressed Ctrl+Break the "wrong" way, you will have this problem with search being interrupted.
Details
According to scan code specifications, Break and Ctrl+Break are special. They send "make" (press) AND "break" (release) scan codes the moment you press Break. They send nothing when you release Break. The buggy keyboard will send the following sequence:
Ctrl "make" scan code
Ctrl+Break "make" scan code
Ctrl "break" scan code
Pause "break" scan code
That is, Ctrl+Break is never released, but instead Pause is released.
Reproduction
You could for example use old good Spy++ from Visual Studio tools. Attach it to anything, for example Windows notepad, and monitor messages (I suggest that you select only keyboard messages). Press Ctrl+Break, releasing Ctrl first. Check the output from Spy++. You will see the sequence I shown in Details section.
I have tried two different keyboards on the same computer. Logitech K120 has the bug while some other Mitsumi keyboard behaves according to specifications and does not have the bug.
If you think about it, it's easy to understand that correct behavior needs special case handling, while buggy behavior is naive. This is why many different keyboards can be buggy.
Solution
Replace your keyboard :)
Workaround
You simply need to press Ctrl+Break, paying attention to releasing Break first. It doesn't matter which application is active.
This bug has been in Visual Studio a long time and it never seems to get fixed.
See this MS Connect item from 2004: http://connect.microsoft.com/VisualStudio/feedback/details/105511/find-in-files-says-no-files-were-found-to-look-in-find-was-stopped
I couldn't believe they still hadn't fixed it in VS2010 - but it's still there :(
The Connect item has been marked as Closed - Won't Fix: https://connect.microsoft.com/VisualStudio/feedback/details/718217/find-was-stopped-in-progress-while-performing-search-in-visual-studio
Ctrl+Break or Ctrl+ScrLk cancel a find operation. Try it. What has happened is that some software layer (presumably Windows) thinks those keys are still being pressed even though they are not. Pressing and releasing them clears the flag.
It could be any of these combinations:
Ctrl+Break
Alt+Break
Break
Ctrl+ScrLk
Remember that you have multiple control and alt keys on your keyboard -- try it with each of them. If it's the right Ctrl key + ScrLk, pressing the left Ctrl is not going to resolve the issue.
Here is the Connect issue which Microsoft closed as "Won't Fix".
If this is a recurring problem for you, there is a Visual Studio extension that suppresses the virtual key that causes the problem.
Ctrl + F and Ctrl + Shift + F have stopped working on Visual Studio 2015 Community Edition.
My friend told me going to:
Tools → Import and Export Settings:
Choose: Reset all settings → Next
Choose: No, just reset settings, overwriting my current settings → Next
Choose: General → Finish
In my case I had a bogus character in the "Look at these file types:" field in the search window.
Removing the character solved the problem.
Visual Studio 2017
Search solution in Visual Studio 2012 is broke. I tested this on three machines, did not work on two. What I found which does work is click on drop down arrow next to search field and select Find all. This is a bit of pain because you have to select drop down every time you search in solution.
I tried all the previous options. They didn't work for me, but reading them made me sure that this is a bug, and I will have to try some unknown ways to get it working. So, I tried a simple file search in Visual Studio 2010 in:
The current document
All the open documents
Both of which worked.
Then I tried Find in Files and woah! It started working.
Unfortunately none of these special key strokes work for me. Only restarting Visual Studio 2010 seems to work for me.
I had the same problem in Visual Studio 2013 (Update 3). None of the key combinations listed previously worked for me. I had *.cs selected in the FileTypes.
To get it working, I changed it to *.*, and then back again to *.cs - now it works.
I have been using Visual Studio 13 without this problem for couple of years now and I started having this issue after applying Update 5 or it could be a weird keys combo pressed by me unknowingly which triggered it, I don't know for sure.
Echelon_Force's solution worked for me. Thanks!
Didn't Work:
Ctrl + Break
Ctrl + Scroll Lock
Worked:
Break (in Find Result 1 & 2 window - Only pressed once)
Happy finding in files!
All of the combinations of Scroll Lock and Break didn't do anything for me. As a workaround, I added the solution directory to the Search Folders (the second ellipsis button), then changed the Look In field to the solution directory. The root problem still exists, but for me, this is functionally the same thing.
(Visual Studio 2013, Windows 8.1, x64)
I was using Visual Studio 2022 (tried with both professional and community, V 17.2.5), my search function was not working in Find in All Files, so I browsed to my solution folder, under .vs\{ProjectName} folder, there is another folder with name FileContentIndex. After closing visual studio and deleting this folder, and restarting vs, seemed to solve my problems, and my Find in All Files started functioning correctly.
I had the same problem as glenneroo today, after updating Visual Studio 2019 to 16.4.3. Found a solution that worked for me here.
Open Find Options and check if there is a (special) character in the Look at these file types text field. If so, remove it.
In Visual Studio 2013 after Update 3, I had the same problem. Before, I could just put ".cs" or ".cshtml" in the Look at these file types: and it would work. But after Update 3 I now have to put ".cs" or ".cshtml" (or whatever file types I want to search in) and it works fine.
This works for me after everything else didn't or worked only sometimes:
Do the search, and while searching, hold CRTL all the time and keep pressing Break.
If you are searching for multiple file types, they must be separated with a ; character, not a space.
This returns the correct results:
*.cs;*.vb;*.js;*.aspx
This returns nothing at all:
*.cs *.vb *.js *.aspx
This isn't the problem the original poster, but for other people who can't figure out why their search isn't working, this could be the reason.
Another late-to-the-party answer, but I found yet another "solution" for this problem.
When it looks as if the Visual Studio app has frozen on search...leave it alone. Don't close it. Don't restart it. Just let it go for about 10-15 minutes and the problem may correct itself, as it did in my specific case. I'm not sure as to why leaving it alone solved the problem, although my wholly uneducated guess is that Visual Studio is building some sort of an index to be able to search files and running into a snag. Once the 10-15 minutes are up and VS completes its search, it seems fine after that.
Probably won't apply to most situations, but what fixed it for me was turning off 'Use Regular Expressions' in the search window. I had previously been using Regular Expressions for some tricky replacements and didn't turn off when finished. I think perhaps it was interpreting part of simple replace text (see below - had some special characters) as the start of an incomplete or malformed regular expression, and so couldn't actually do any matching. Would be nice if it told you!
It only seems to lock-up if I use Ctrl + F (Find in Entire Solution) and never if I use Ctrl + Shift + F (Find in Files).
That Ctrl+Break trick worked for me for years, it's really interesting to finally understand why this happens. With VS2015 I have somewhat related problem with search: my Ctrl+Shift+F simply does not work, this key combination seems to be ignored when I press it. I tried to reinstall even VS 2015 and I still got that same broken behavior.
In case somebody has identical problem, here's what was the reason:
I turns out that for whatever random reason VS2015 shows that "find in files" dialog on another monitor that's attached to my PC. That other monitor is 4K Samsung TV that normally stays "Off" and I have no clue why VS 2015 sends that search dialog box to that monitor. Surprisingly, when I turn on my TV the search dialog moves to the primary monitor on its own!
Ctrl + Break works for Visual Studio 2008
Nothing worked for me. I use also Resharper. So I had to reset my VS key bindings and reapply Resharper shortcuts. Only this got me it working.
Reset current keyboard configuration (Tools | Options | Environment | Keyboard | Reset).
Go to ReSharper | Options | Environment | Keyboard & Menus | "Visual Studio" | Apply Scheme.
I am running Visual Studio 2012 Professional in a Virtual Machine, connecting using rdesktop from a Linux machine.
None of the other suggestions worked, but solved the problem was:
Go to the 'Find and Replace' screen. (ctrl-shift-f in my case)
Enter a search text and choose 'Entire Solution'
Hit 'Find Next', it should find a result.
Hit 'Find All', now works without aborting. (Note, i hit my Mouse really hard and some swearing was involved, too, but I don't think that has any relevance apart from a psychological one :D )
Tried all the solution, but the fixed of mine was I accidently change to another language keyboard on my windows, after I change back to English keyboard, it work, finally I can ctrl + shirt + f
I'm currently using VS2019 16.7.7, and, if I try to find something in the whole solution, VS never finds all the occurrences, sometimes only one, or none.
In some recent release of VS2019 (perhaps 16.5 or 16.6) the old "Find and replace" dialog was replaced by a new "Find in files" dialog, and this new one is failing for me. One solution that worked for me was to disable the new "Find in files" and keep using the old "Find and replace" dialog by checking Use previous Find In Files in Tools > Options > Environment > Preview features.
However, I observed that this was only failing in one of my open Visual Studio instances, so I tried the simple "close VS and open it again", enabled the new "Find in files" functionality, and it started working.
Two possible solutions, in case the simple "close and open again" fails.
The following worked for me. Visual Studio → menu Windows → Reset Window Panel. The resizing of Visual Studio made it to hide the option.
This was one of my biggest problems with Visual Studio. For me (Windows 10, Visual Studio 2015) the find in all files window got locked with a white-out, and guess what, hitting print screen solves it.
This has begun occurring for me with the update to Version 15.8.8 of Visual Studio. None of the above steps worked. There is no error. Just what appears to be a 'stuck' search.
I had recently installed ApexSQL Refactor 2018.03.0331. Uninstalling this did not resolve the issue and does not seems to be the cause. It seems to be related to Version 15.8.8 of Visual Studio update.
I completely uninstalled Visual Studio and reinstalled Version 15.8.8 again. The issue with Ctrl-Shift-F searching the Entire Solution is no longer an issue. Whatever caused the problem does resolve after uninstalling and installing.
I once again installed ApexSQL Refactor 2018.03.0331 and everything still works well.

Resources