How to get list of Visual Studio commands?
Asked Answered
O

3

10

We are working on an VS extension that requires a list of Visual Studio commands like the one in this screen shot:

Screen Shot from Visual Studio 2010, Tools > Options > Keyboard

Example:

  • Action.Add
  • Action.Add.NETFrameworkLaunchCondition
  • Action.AddAction
  • ... etc.

Where can we find or how can we access this list?

Orchestrate answered 7/8, 2012 at 13:14 Comment(0)
V
3

visual studio contains this lists ...\Microsoft Visual Studio 9.0\Common7\IDE\*.vsk

Variation answered 7/8, 2012 at 13:17 Comment(0)
F
9

You can access it via the DTE interfaces. Get the EnvDTE.DTE interface via GetService(typeof(SDTE)) (or other appropriate mechanism) and then:

EnvDTE.DTE dte = ...;
var commands = dte.Commands.Cast<EnvDTE.Command>();

foreach (var command in commands.OrderBy(c => c.Name))
{
    Console.WriteLine(command.Name);
}

I should mention this can be quite slow, so it's best avoided if you can...

Folacin answered 10/8, 2012 at 2:45 Comment(1)
There isn't really an async version. The EnvDTE API is affinitized to the UI thread. You could run that on a background thread, but you'll trigger marshaling back to the UI thread transparently which would make the code even slower than it is normally. In the end of the day, enumerating all commands is really one of those "don't do it" things. Normally if somebody asks for this I push back and challenge them why they need to do it.Folacin
V
3

visual studio contains this lists ...\Microsoft Visual Studio 9.0\Common7\IDE\*.vsk

Variation answered 7/8, 2012 at 13:17 Comment(0)
D
0

Here is a handy list of VS commands compiled by Mads Kristensen for his VS VoiceExtension.

Defoliate answered 17/5, 2016 at 8:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.