Visual Studio 2015键盘快捷键-高亮功能定义 [英] Visual Studio 2015 Keyboard Shortcut - Highlight function definition
问题描述
使用一些 Visual Studio键盘快捷键,我正在尝试突出显示比向下扩展行" Shift +向下箭头(击键太多)更有效的方法.
Using some visual studio keyboard shortcuts, I'm trying to highlight a function definition in a more efficient way than "Line Down Extend" Shift+Down Arrow (too many keystrokes).
我能得到的最接近的是通过 "Goto Brace Extend" 突出显示身体. Ctrl + Shift +]
The closest I can get is highlighting the body with "Goto Brace Extend" Ctrl+Shift+]
但是,这省略了函数声明public Function()
.如果首先使用Shift +向下键突出显示该声明,则在按下Ctrl + Shift +]时该声明将不突出显示.
However, this omits the function declaration public Function()
. If the declaration is first highlighted with Shift+Down Arrow, it becomes un-highlighted when Ctrl+Shift+] is pressed.
推荐答案
您可以将以下命令用于 Visual Commander 以选择当前的函数定义:
You can use the following command for Visual Commander to select the current function definition:
public class C : VisualCommanderExt.ICommand
{
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;
if (ts == null)
return;
EnvDTE.CodeFunction func = ts.ActivePoint.CodeElement[EnvDTE.vsCMElement.vsCMElementFunction] as EnvDTE.CodeFunction;
if (func == null)
return;
ts.MoveToPoint(func.GetStartPoint(EnvDTE.vsCMPart.vsCMPartHeader));
ts.MoveToPoint(func.GetEndPoint(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes), true);
}
}
这篇关于Visual Studio 2015键盘快捷键-高亮功能定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!