Navigate to a region quickly - visual-studio

Superfluous qualifier: This is probably a silly question, but...
Using VB.NET and / or C#:
Is there a way to jump to a region quickly, similar to the way you can choose a class and find functions / methods / events from drop-down lists? I have organized thousands of lines of code into neat regions but it seems like a waste if I can't find them quickly.
I now realize Ctrl-M + O (outlining) will basically give me what I was looking for, but the question stands.
Update: Since the community and myself can't seem to find a way to do this, the answer to my question is: No, there is no way to do this. With this knowledge, I won't be so concerned with regions in the future as their usefulness is limited.
Update 2: This question originally applied to VS2010. However it seems to be applicable to later versions as well. At least in 2015, it seems you can quickly jump between regions using keyboard shortcuts.
Relevant Question: VS 2015 shortcut for "GoTo Region" #region / #endregion

Depending on how your code is wrapped in #regions you can use the built-in feature to Collapse to Definition Ctrl + M , O. Then navigate to the region you want. You can undo the collapse by using Ctrl + M , P

You can create bookmarks in Visual Studio 2010. Nice article here - http://www.codeproject.com/Articles/42973/Using-Bookmark-in-Visual-Studio

You can try the extension CodeNav that let you see also the code regions on the left pane.

Related

VS2015: Can I mark down code?

When I'm working at someone else's code, sometimes it happens that I've found something useful that I likely will need to return later to.
Except the chances are that I forget where I've found that part and then I need to find it again. Nowadays I'm mostly using breakpoints to set these down, But I don't need these breakpoints for debugging, so I don't think that's the most efficient method. Something that could work for me is a sort of marker that functions marking down like a breakpoint, but does not affect debugging.
Will all these ways of breakpoints, search functions, finding references, and adding a Watches. I do have a feeling that such feature is present in Visual Studio already. But I havn't found it yet, I've already tried searching it up, but it looks like it hasn't asked before.
So, is there a feature in Visual Studio that let you mark down code like breakpoints, but just for the purpose of marking down?
There is more than one way to do so.
If I finde something interesting I mark it with a Bookmark.
Just STRG + K, STRK + K and it will be places on your current row.
With these Buttons you can switch to your bookmarks or delete them all. They are client based.
Visual Studio also gives you a "To Do List" Function. This one is triggered by comments in the code and seen for everyone with the right options used.
See here how it works in detail.
Yes, it's called a bookmark. This little toolbar is for bookmarks:
You can also use the Edit, Bookmarks... menu item and the View, Other Windows, Bookmark Window which among other things lets you see all of them and give them names.
One caveat: the bookmark binds to the line number, and doesn't move if you add or remove lines. So if you bookmark the first line of a function, then make changes above that, the bookmark won't be on the first line of a function any more.

Incremental Search vs Quick Find in Visual Studio

What is the difference between Incremental Search (Ctrl + I) and Quick Find (Ctrl + F) in Visual Studio?
as I said in the comment of mine , that's not the only reason and microsoft would not implement something like this for just being easier to use !
by the way you don't need F3 to navigate between the results in the normal find method . you can do that with hitting enter and hell yea , its easier than Ctrl+I.
You can press Ctrl-I and start to type and all occurrences of what you type get highlight throughout the document, and also added to the find buffer, so F3 then works on the typed text as-well as the normal find method.
Incremental search allows developers to search in document without blocking UI and allow to search as they type.
The very good reason to use Ctrl+I is it find the result as you type the term in the box and you don't need to hit enter or F3 to go to the first result .
How To :
To enable incremental search, just type “Ctrl + i” within the editor.
This will subtly change your cursor, and cause your status bar at the
bottom left of the IDE to change to “Incremental search: (search
term)” – you can then type the search term you are searching for and
the editor will search for it from the current source location you are
on (no dialog required).
Note that the version of Visual Studio will affect the UI differences. It seems that in older versions e.g. 2010, the find dialog was quite obtrusive, and got in the way of things and so incremental search was by comparison more streamlined. Conversely, running on Visual Studio 2015 I've found that the Find Dialog (at least the one launched by CTRL-F) is very unobtrusive, since it is embedded in the top left of the code editor. Hitting CTRL-I in fact launches a similar dialog with fewer options. Furthermore I also find with this version of VS the editor jumps to the first matching occurrence as with incremental search, so there is barely any difference in terms of how streamlined/unobtrusive one is over the other.
Assuming one is using a version of Visual Studio where the Find Dialog is embedded in the corner, the only reason I can think to use incremental search over the standard find is the fact that you can reverse search with CTRL-SHIFT-I (the alternative would be to CRTL-F to go to the next occurrence, then SHIFT-F3 to go backwards).
Long story short: it looks like the standard find has been modernised somewhat bringing it closer to the incremental search. If using VS2015 (not sure about 2017) the difference appears to be fairly negligible besides the differences in shortcuts, and so is really a matter of preference. Personally, in VS2015 I find the incremental search to be of little improvement over the standard find, and so I'll be sticking to the latter (unless I've missed something in which case I'll be glad to hear about it!)
Incremental search allows you to keep hitting Ctrl+I until you hit the end of your document. Quick Find finds the first hit, highlights every other hit but you'd need some additional keys to go the the next hit (F3 with standard keybinds).

Visual Studio Express, How to hide object properties like functions

I hope my question is clear enough. I am using free version of visual studio express.
When I create a function, there is that "-" or "+" sign next to line number where function is created, which allow me to hide it.
I want to do same thing for my object which is really long because it is storing alot of items. All items are sorted by area, and group which looks like this:
var itemTable = {
groupA: {
BanditHideout: {
itemDrop: [
//Weapons
{
After all items are listed, there is next area and inside it another item list.
Once all areas are done, we move on to groupB and do the same thing, and there are like 10 groups in total each having 5 areas.
I managed to do it manually using "outlining" option in visual studio, where I mark a whole text and press "Ctrl + M" and then "Ctrl + H" which hide the content and create "+" sign next to line number.
I do that for every part i want to hide, and it works well. My problem is that, I have to do it manually which is bad, because for some reason, sometimes all "+" dissapear, and I am forced to do it all over again.
I hope that I am clear enough and you can help me out somehow :) Let me know if you need more information. I can give you a screenshoot if that will help. Thanks for help in advance
You can always use regions :)
#region RegionName
[some of your code]
#endregion
PS. Well, apparently not always ;]
PS2. Since Visual Studio Community edition has been released, there really is no need for VS Express anymore - it lacks wayy too many features compared to the standard version.
BUT - if you're coding only in JavaScript, I'd consider some other, "lighter" IDEs than Visual Studio (off the top of my head - Eclipse or NetBeans, but there's tons of other free IDEs out there).

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

Is there any way to 'highlight' code? [duplicate]

This question already has answers here:
Is there a way to highlight the currently active code block in Visual Studio 2010?
(4 answers)
Closed 9 years ago.
I'm currently using Visual Studio 2010 (and also have a copy of Visual Studio 2005 which I'm also happy to use if the functionality is available in it but not '10)
What I'm wondering is if there is any way to highlight pieces of code?
For instance, I'm currently working on an assignment to take a piece of code, and change the stack implementation. It would be really useful if I could highlight the stack implementation specific pieces of code so that it's easy for me to just glance at the screen and know which pieces need my attention rather than having to visually wade through it.
(I am using comments to highlight the stack implementation specific code - but they get a little lost amidst other comments - and this seems like a better idea.)
You might consider using bookmarks at the start of a section you are interested in, or on a specific line. While this does not highlight the lines of code, it does provide a visual indicator in the left margin.
If you use the AllMargins extension, it also appears there. This is a handy way to quickly see if there any bookmarks in the current document, and also helps since the bookmark icon on the left will not appear in collapsed regions.
By using bookmarks, you can also use the bookmarks window to quickly navigate to the code you are interested in:
Consider using #region and #endregion blocks.
From MSDN:
#region lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor. In longer code files, it is convenient to be able to collapse or hide one or more regions so that you can focus on the part of the file that you are currently working on. The following example shows how to define a region:
#region MyClass definition
public class MyClass
{
static void Main()
{
}
}
#endregion
For smaller sections / individual lines of code a quick way to jump between or keep track of them is to use Bookmarks. These can be added by using Ctrl+K, Ctrl+K and you can press Ctrl+K, Ctrl+N to move to the next bookmark, or Ctrl+K, CTRL+P for the previous bookmark. The Navigating Bookmarks article is a good quick reference.

Resources