I've been searching the internet for the last week and can't find a working example. I'm trying to build a visual studio extension that formats the code. I've read up all the walk-throughs on Microsoft documentation. I just want to know how to create a shortcut that when pressed, will read all the text in the editor and allow me to format it and write back to the editor. I'm working with the Visual Studio 2019 SDK.
Does anyone know of a simple way to do this? Any help here would be appreciated as I'm out of ideas where to look.
You need to create a VS command, see https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-an-extension-with-a-menu-command?view=vs-2019
and then assign a shortcut to it in VS options or programmatically.
In the command, get dte.ActiveDocument and use txtDoc.StartPoint.CreateEditPoint() and other points to read and modify text, see https://learn.microsoft.com/en-us/dotnet/api/envdte.textdocument.startpoint?view=visualstudiosdk-2019
In the Visual Studio 2010 Customize->Add Command dialogue, I can select a command from a category. Given a command name, how do I know which category to look in? I want to add 'Selection Format' to my code window context menu but I can't seem to find it anywhere I look.
I don't know what process you can use to find out where it is.
I do know that it is in the Edit Category though.
On top of visual studio code editor, There are two drop down lists displays list of classes and members in then selected class. See the picture below. What do you call them and what are the shortcuts? So that I can navigate to methods and members using keyboard.
I am using Vs 2010
Thanks
CtrlF2Tab gets you there. Take a look at this link. Is there a hotkey in Visual Studio to open the member drop down list?
Not strictly on topic but ReSharper has a shortcut for this Alt+\
Can use Edit -> Navigate to [Ctrl + ,]. or Solution Navigator in Vs Power Tools. But I am still looking for shortcut to access it directly.
Thanks
I guess it is Edit.ExpandCollapsableBaseTypeList (or something) in the Tools-Options-Keyboard.
If that doesn't work you can always record a macro and assign a shortcut key for that.
I have to cs file for one partial class. I know that I can modify project file to group them together like way that vs.net group *.aspx and *.aspx.cs, but is there a way to do that in vs.net IDE directly?
I believe this is the plugin you are looking for:
http://mokosh.co.uk/vscommands/
Works in VS 2008 and 2010.
You can install VSCommands extension for Visual Studio 2012. Select files to group from Solution Explorer, Right click -> Group Items.
Guy from Microsoft says the only way is by editing the CSPROJ. Maybe an extension will pop up soon that does this.
Does Visual Studio 2010 have a built-in way to quickly find/open files, similar to the Ctrl+Shift+O function in Eclipse?
Or does ReSharper offer this functionality?
Ctrl+,
I'm surprised no one gave the right answer:
Navigate To can show you a list of open files and lots more.
http://weblogs.asp.net/scottgu/archive/2009/10/21/searching-and-navigating-code-in-vs-2010-vs-2010-and-net-4-0-series.aspx
CTRL+COMMA is your friend.
Ctrl + Alt + A opens the command window, type "open" then start typing file names and it will dynamically autocomplete by available solution file name.
I use Ctrl + / to jump to the command bar (same as the search box, but with a > prefixed in the text). I then type "of" (for "open file") and start typing the name of the file to open. Possibly matches are automatically displayed by VS.
I also found that when using ReSharper, the familiar Eclipse shortcut for Open Type (Ctrl + Shift + T) is mapped to ReSharper's GotoFile command.
There is also another way to find files in the Visual Studio 2010 might be useful for someone.
In the command box in visual studio toolbar type ">of " and start typing the file name it will prompt list. Note: This will only find the class not the pages try it for yourself.
this addin will very usefule to quickly open files from visual studio by pressong CTRL + K + O
http://visualstudiogallery.msdn.microsoft.com/en-us/3eb2f230-2728-4d5f-b448-4c0b64154da7
In VS2017 or later versions, we have command called "Edit.GoToAll".
SO can configure it from VS tools.
see below snap.
I have configured my keys for file search as CTRL + SHIFT + T
CTRL+SHIFT+F will bring open a find in files search dialog box. The result will be listed, usually, on the lower section of VS in a Find Files result box. Double clicking a result will open it
DPack has a dialog for finding files in the current solution (search all, or only open files), and it also has a dialog to search the current file for methods,properties, etc. Very nice! Note that the current version only supports VS 2012 or newer, but they have binaries there for older versions of VisualStudio as well:
http://www.usysware.com/dpack/
You could also try Sonic File Finder, which does something similar to CTRL+COMMA:
http://www.jens-schaller.de/sonic-tools/sonicfilefinder/overview/overview.htm
In Eclipse, Ctrl+Shift+O = "Organize Imports"... which I am not sure what this is. But it is not the Ctrl+Shift+F = Find in Files that is in Visual Studio.
VSFileNav - An extension that I created that allow rapid file searching. It's basically got all the ReSharper functionality that was disabled in the express version of VS2010 (I used to really like this).
It's also free :)
For file name search, I use the Visual Studio Productivity Power Tools.
It adds a tab to Solution Explorer called "Solution Navigator". It shows all the solution files in a tree and has a search bar at the top.
To search for text in all your solution files, use Entrian's Source Search:
https://stackoverflow.com/a/9994522/24267
Visual Assist comes with something like this. You will have to pay for the plugin (and I don't think you can use plugins in the express versions).
(If you're doing C++ and you don't plan to buy Visual Assist, be sure to never install the trial. It's that addictive.)
I usually use Ctrl+Q or Everything tool via a hotkey.
For fuzzy search of files (and more) I needed to use cmdp
Unfortunately, VS doesn't offer this search-as-you-type functionality (and lots more).
Type >open filename in the command box in the Visual studio can also open the file
NavigateToAll extends the built-in Navigate To by enabling you to open any file on the disk (not just the ones in the solution).
CTRL + P, the right solution for me....
CTRL + , -> SETTINGS