【问题标题】:How to execute shortcut key commands to Visual Studio Extension如何对 Visual Studio Extension 执行快捷键命令
【发布时间】:2017-04-26 15:01:49
【问题描述】:

我正在开发一个 Visual Studio 扩展,它需要使用快捷键 Ctrl + 6 执行命令,用户应该能够执行命令,如 VS 构建命令 (Ctrl + F5)。我使用了以下方法,但它需要在选择文本编辑器时执行命令。请告知如何解决此问题。

<KeyBindings>    
    <KeyBinding guid="CommandSet" id="MyCommand" key1="6" mod1="CONTROL" editor="guidSourceCodeTextEditor" />
  </KeyBindings>

  <Symbols>
    <!-- This is the package guid. -->
    <GuidSymbol name="MyPackage" value="{ccccc-cc-cc-cc-ccccc}" />
    <GuidSymbol name ="guidSourceCodeTextEditor" value="{8b382828-6202-11d1-8870-0000f87579d2}" />

    <!-- This is the guid used to group the menu commands together -->
    <GuidSymbol name="CommandSet" value="{xxxxx-xxxx-xxx-xxx-xxxxxxx}">
      <IDSymbol name="MyCommand" value="0x0100" />      
    </GuidSymbol>        
  </Symbols>

【问题讨论】:

    标签: visual-studio-2015 vs-extensibility


    【解决方案1】:

    问题出在这里:

    editor="guidSourceCodeTextEditor"
    

    我认为您需要将其更改为:

    editor="guidVSStd97"
    

    https://msdn.microsoft.com/en-us/library/bb491775.aspx

    【讨论】:

      猜你喜欢
      • 2019-08-01
      • 1970-01-01
      • 2011-01-17
      • 1970-01-01
      • 1970-01-01
      • 2011-07-01
      • 1970-01-01
      • 2021-07-17
      • 1970-01-01
      相关资源
      最近更新 更多