visual studio, which bookmark is this - visual-studio

I am debugging my code and come across a bookmark I set earlier, my bookmarks have nice names, and I would like to know which bookmark this it. The bookmark window is open, and the last bookmark I clicked on is highlighted, but not the one I am on.
How do I ask visualstudio, “What is the name of the bookmark, that is on this line of code?”
My current method is to click each bookmark in turn, in the bookmark window until I get back to the line I was looking at.
(using visual studio 2012, professional)

There is no command to synchronize Bookmarks window with current cursor position but you can use this macro as a workaround. The macro assumes that the bookmark where the cursor is is enabled and it will enable all bookmarks after run, which may be a problem to your use case.
Sub SyncBookmarksWindow()
DTE.ExecuteCommand ("Edit.EnableAllBookmarks")
DTE.ExecuteCommand ("Edit.EnableBookmark")
DTE.ExecuteCommand ("Edit.NextBookmark")
DTE.ExecuteCommand ("Edit.EnableAllBookmarks")
End Sub
Bind this macro to a keyboard shortcut and sync away.
EDIT: Unfortunately VS2012 does not allow for macros anymore, and you have to create an Add-In. For how-to see another question on this site.

Related

In Visual Studio is it possible to see what the name of a bookmark is within the code window? (eg hovering your mouse over it to the left of the code)

In Visual Studio is it possible to see what the name of a bookmark is?
Quite often I put in bookmark to remind me about a piece of code I need to get back to, then later when I do something else I come across the bookmark. (Which is often one amongst many) However if I hover the mouse over the bookmark it doesn't tell me which one it is. Can this be switched on?
It cannot be switched on, and left-clicking in the gutter is just going to toggle a breakpoint. The closest you can get without venturing into third-party add-ons is to keep the Visual Studio Bookmarks window pinned to your workspace--or within easy reach. To open that window, hit [Ctrl]-grave accent and it will highlight any bookmark you navigate to using [Ctrl]K, [Ctrl]N or [Ctrl]P (next/previous bookmark) or [Shift][Ctrl]K, [Shift][Ctrl]N or [Shift][Ctrl]P (next/previous bookmark in the current folder).

xcode 5 file navigation for visual studio user

I've used Visual Studio for years and have just started work on a C++ project in XCode, and I'm finding some aspects of file navigation in XCode frustrating.
If I have several files open, and I use the mouse swipe left or right to reveal a previous/next file, the editor always repositions the window to the top of the file, instead of where I was looking at it previously. Is there any way to keep the file positioned at previous line?
In Visual Studio I often used bookmarks within a file, and then keyboard shortcuts to move forwards and backwards through them. Is there an equivalent in XCode?
Is there any shortcut to show a list of the currently open files so that I can view one of them? (I miss the Visual Studio tabs.)
I have the same complaints and have not found a good solution, but there are a couple of things I have done.
I have placed commented out keywords throughout my code. For example, when I was implementing iAds into my project I added "//iads imp" into my code, thus I was able to quickly do a command+f and type in "iads imp" and I would go to that section of code.
The other solution I use for this is pragma marks:
According to this site,
"Pragma mark is simply a way to organize your methods in the method list pop up button in Xcode "

Is there a keyboard shortcut to move the cursor between methods in Visual Studio 2010?

Is there any keyboard shortcut to move the cursor between methods in Visual Studio? Is there any plugins that can do the same job?
All the time when I program, I want to go at the end of the current method and if I could have a shortcut that can move the cursor at the beginning of the next method and then just have to type a couple of up arrow to be where I want would be fantastic.
Thank you.
Note: For VS <2015, the following works only for the VB.NET code editor. In VS 2015+, apparently the C# code editor is also supported.
While there are no default keyboard bindings to jump between methods, you can set them up yourself:
Go to Tools → Customize…, then Keyboard…, and do the following:
Search for the commands by typing Method in the input line at the top.
Locate the two commands Edit.NextMethod and Edit.PreviousMethod.
For each of these, select the command first, then move the input focus to the input field Press shortcut keys, enter an unassigned key combination, and press the Assign button.
(The screenshot above shows that I have previously assigned one of these commands to Ctrl+Shift+<.)
Hi another (cheaper) alternative might be the CTRL+M+M to collapse/expand the current method to it's definition, allowing you to quickly navigate to the next.
Also CTRL+M+O to collapse all members is useful, with CTRL+M+L to expand all again.
Visual Studio doesn't have such a function, but JetBrains' ReSharper does. At least is the only one that I know of to offer this functionality.
For ReSharper the shortcuts are Alt-Up and Alt-Down, for previous/next member.
Try CTRL + ALT + UP. This first takes you to the scope selector where you can select a class if applicable, then press TAB which takes you to the method selector where you can select a method from the selected scope.
Note I use In Visual Studio 2012, don't know if works in other versions.
Jason Malinowski is right on his comment. It even says the shortcut keys are Ctrl+Down Arrow and Ctrl+Up Arrow. I used to use this all the time in VB6, but when I tried it lately using recent versions of visual studio, it didn't work; it would just scroll the edit window up or down one line.
When I went into Tools -> Options, select "Environment" on the left, and then the subcategory of "Keyboard", then type "Edit.ScrollLineDown" it said Ctrl+Down Arrow. When I removed this shortcut (and the one for ScrollLineUp), the next/previous method shortcuts then worked! I'm personally very happy about this.
Obviously, if you can find the right command, you can customize your keyboard shortcuts any way you please here.
I know this is old, but looks like it was added since.
Try Alt+[ or Alt+]
In Visual Studio 2013 with the commercial Visual Assist expansion you can use ALT+M to open a list with all methods in the current file. Select one, hit ENTER and the cursor will jump to it.
do not forget about the excellent, free DPack extension, which will add Alt+m shortcut which will open a list of all methods in the current class. You can type a search string to filter, and what is also great is if you tab down and enter on a method, and then later do Alt+m again, if you tab into the window you will be on the last method you selected. DPack also has many more features, like bookmarks, but I do find that you have to setup the hotkeys, or more exactly, re-assign hotkeys from other functions to DPack: https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348
Its Ctrl + } - by placing the cursot to end of line - using studio 2015
Same will also bring the cursor back to bottom.
so place the cursor at end of function and press Ctrl + }
In Visual Studio 2015:
Alt + Up or Alt + Down

Refector-Rename ASP.Net Controls

Is there any way to Rename ASP.Net Controls without searching the complete Markup or Codebehind.
In Visual Studio there is Refactor Rename but this only works in Codebehind I still have to search the Markup code.
I'm using VS 2008.
Yes. I've found that the easiest way to do this is from the code behind.
There exists a shortcut called Rename Refactoring that is bound to the keyboard combination (Ctrl+R, Ctrl+R). The combination is listed as "Refactor.Rename" in the keyboard settings, if you want to change the shortcut (or if it's not bound, for some reason, you can set it yourself.)
To rename your ASP.NET control, navigate in the aspx.vb file to a reference of the control. Put your mouse cursor on the variable name. Press the keyboard shortcut. Now, you can either start typing (will erase the previous name and start typing a new name), or click somewhere or use the arrow keys to navigate to a specific position in the variable, after which you can add/remove/change the name as you please.
Clicking elsewhere will not apply the changes. To apply the operation, either click "Apply" in the dialog at the top-right that appeared, or press Enter.
The ASP control will be renamed in the VB code, and in the aspx code!
Note that there are certain file types where Refactor.Rename is "not available", such as .ashx or Visual C++ files.

What is the best way to bookmark positions in code in Visual Studio 2008/2010?

I find myself going to about five or six main places in my code 80% of the time and would like a way to go to them fast even if all files are closed.
I would like to be able to open up a solution in Visual Studio and without any files open, see a list of self-labeled bookmarks like this:
LoadNext
Settings page refresh
app.config connections
app settings
stringhelpers top
stringhelpers bottom
I click one of these and it opens that file and jumps to that position.
How can I best make bookmarks like this in Visual Studio 2008/2010?
Use task list shortcuts:
On a line in text editor use keys (ctrl + k, ctrl + h) this will add a task list shortcut.
Open task list tool window.
In task list tool window select "short cuts" in the drop-down list.
The task list will the show a list of lines where you made a task list shortcut, whit the text from that line.
Why not use the Bookmarks feature? I have the Bookmarks window at the bottom of my Visual Studio window, collapsed. You can view this by going to View -> Other Windows -> Bookmark Window (in VS 2008, anyway).
You can add a bookmark to any line of code; it will then appear in the Bookmarks window. You can then rename the bookmark to whatever you want. It doesn't matter if the file is open or not.
I'm assuming you want this on a per-solution basis rather than a generic set of bookmarks that know how to find a particular type of file. The approach above would seem to be what you want. It seems like Visual Studio remembers a set of bookmarks for each solution; I guess they're stored in the .suo file.

Resources