I usually use the CTRL+M CTRL+O to collapse sections or regions in my cs files in Visual Studio 2017. This keyboard shortcut is also working nicely in my JSX files. However, it's NOT working in JS files.
Interestingly, VS 2017 is able to see and understand functions, even sections within functions such as if blocks, etc. As you can see in image below, it also offers me those +/- icons to collapse them. Using the mouse, I can collapse them but my keyboard shortcut is not working.
How do I get VS 2017 to collapse everything to definitions in JS files using keyboard shortcuts?
The cause of this behaviour seems to be the use of the arrow-function - if you change that to a regular function-definition, the section will collapse using Ctrl+M Ctrl+O ('Collapse to definitions') like you expect it to.
This will, however, cause you to lose the perks of the arrow-function, which is less than optimal, especially when used in conjunction with promises.
What exactly is causing this, however, I haven't been able to discern, and all attempts of fixing it have so far proven futile.
Here's an example of how your outline should work as expected:
return function (dispatch) { fetch('/api/accounts/members/search', fetchOptionsPost(request))
.then(function(response) {
if(response.ok)
{
...
}
});
Can anyone confirm whether or not this behaviour occurred in VS2015?
Cheers
Edit 1: Ctrl+M Ctrl+L switches all outlines (not just definitions), which seems to include arrow-functions as well. You might have to press it twice, though, because as soon as a single item is collapsed, it expands everything.
Which begs the question whether this is not a bug, but indeed a feature, depending on whether or not you view the arrow-function as a 'definition' or not.
Related
When previewing a file by clicking on it once in VSCode, is it possible to preview other files in the explorer by using the arrow keys, similar to Visual Studio? When I do it, it just selects the file, but doesn't preview it (unless I use my mouse). I'd provide a picture, but the upload isn't working right now, sadly. :(
I feel like that used to be a thing and I broke it at some point, but I could also just imagine it due to VS.
https://stackoverflow.com/a/66237216/12903844 has exactly what I was looking for!
Short summary: Up/Down + Space will enable you to preview a file, but you can also use 'multi-command' to macro it to just Up/Down (without having to press Space when selecting files this way).
Credit goes to Mark for answering it in the comments, just adding it here so the solution is marked. <3
I have a question about Visual Studio 2013.
I just installed it and it seems pretty good because of the new features.
But there is something I do not like:
Is it possible somehow removing these 3 x buttons ? Or just one of them?
Yes you can hide them.
Close Visual Studio.
Open regedit and find MainWindowFrameControls.
For example I want to remove:
1) Sign In
2) Notifications
So I need to delete:
{304ee989-b7c9-46c8-aa48-f080bc47cee0}
{73988e61-7e30-4e87-b891-23b5e460db21}
You can also delete them and it will work (you can remove feedback also by this way).
Although sometime VS recreates that keys. But solution is very easy - instead of deleting make right click and go to Permissions, add Everyone - Deny - Read. So now nobody will be able to read that keys including VS.
You can remove it to go to original state by the same way.
At the moment the social features don't seem to have any corresponding options you can use to disable them.
There is a method that relies on using Visual Commander extension to repeatedly hide some of the buttons (as Visual Studio
often recreates them), which seems like the closest you'll get for the moment.
http://visualstudioextensions.vlasovstudio.com/2013/10/19/hide-sign-in-and-feedback-buttons-in-the-visual-studio-2013-main-window/ - You can view the code in the "Extensions" section.
Unless you're desparate to get rid of them, you're probably better of trying to ignore them, hopefully an option to hide them will become available.
You can use the Disable Social Features extension, which will programmatically hide both the 'smiley' buttons as well as your own name/photo from the front of Visual Studio.
I want to be able to move the cursor (not move the line of code) in the text editor up a block or down a block by pressing <ctrl>+<uparrow> or <ctrl>+<downarrow>. In jEdit, Leafpad, etc, this just works out of the box. I do not want to move an entire page at a time, just simply go to the start or end of the text block that I happen to be on.
Specifically, I want this, but for VS 2012 (which no longer has macros):
keyboard shortcut to move from one code block to another in VS2008
I've seen these posts, and they are not what I'm after; I do not want to move code, I want to move the cursor to the top or bottom of the block I happen to be on.
Visual Studio: hotkeys to move line up/down and move through recent changes
Visual Studio - Scroll AND move cursor
I have checked in ReSharper as well, and cannot seem to find an answer there.
Does anyone know of an add-in that provides this functionality?
Bind them to Edit.PreviousMethod and Edit.NextMethod in the Options->Environment->Keyboard?
I removed everything that was bound to these shortcuts, then bound it to Edit.PreviousMethod and Edit.NextMethod. This put the focus on the method box in the editor, but then you have to press enter to get it to navigate to that method.
The best I could find was using ReSharper, which I was trying to avoid. However, I'm a minimalist and ReSharper got in my way, I was leaving it toggled off almost all the time, so I uninstalled it.
I believe it was ReSharper.MoveToNextMethod or .NavigateToNextMethod, but I have uninstalled it so I'm going on memory. Using it, it would jump to the beginning of the previous or next method, which was not quite what I was looking for, but better than nothing.
Edit: I gave up. I moved to .Net Core for c# code and do all my editing outside of Code, using text editors that employ common keyboard shortcuts like Geany, jEdit, etc.
Has anyone ever seen behavior like this in the Visual Studio 2010 Work Item editor, and found a solution:
The odd outlining of the upper controls is not a big deal, but the lower sections consist of several tabs that are completely invisible. They exist, and can be tabbed through, but you simply cannot see them.
This issue seems to crop up randomly. Sometimes I will open a work item and it will render like this, sometimes it will render correctly. Sometimes simply closing and reopening the work item will correct the issue, sometimes it won't.
I am having a strange problem with IntelliSense in Visual Studio 2010 C# Express Edition: when it pops up to show me the list of suggestions, the list is missing valid options.
For example, say I want to add a "KeyDown" event handler to a control, I start typing "someControl.K<Ctrl+Space>", but the popup doesn't list the KeyDown event; actually, it does not contain anything starting with a K (not KeyPress or KeyUp either).
This is not so bad, since simply typing "KeyDown" by hand won't kill me, but it is highly irritating, especially when I am dealing with objects whose members I am not familiar with.
After all, one of the uses of IntelliSense is giving you a quick overview of what Methods/Properties/Fields/etc. the object has to offer - but if it leaves out some of them semi-randomly, that point is rather moot.
(By semi-randomly I mean that, while there does not seem to be any discernable pattern for which members are left out, at least it is consistent in that it is apparently always the same ones that are missing.)
Does anyone have any idea what might be causing this phenomenon? A corrupt IntelliSense cache? Is there a way to purge that cache and force a rebuild?
You could try to delete the .sdf and .suo files of your solution (after closing it) and then reopen it.
Also make sure that all Statement Completion options are checked and 'Hide advanced members' is unchecked (see picture).