Visual Studio 2015 键盘快捷键 - 高亮功能定义 [英] Visual Studio 2015 Keyboard Shortcut - Highlight function definition
问题描述
使用一些
然而,这省略了函数声明public Function()
.如果声明首先使用 Shift+向下箭头突出显示,则在按下 Ctrl+Shift+] 时它会不突出显示.
您可以使用以下命令进行VisualCommander选择当前函数定义:
公共类 C : VisualCommanderExt.ICommand{公共无效运行(EnvDTE80.DTE2 DTE,Microsoft.VisualStudio.Shell.Package 包){EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;如果(ts == null)返回;EnvDTE.CodeFunction func = ts.ActivePoint.CodeElement[EnvDTE.vsCMElement.vsCMElementFunction] as EnvDTE.CodeFunction;if (func == null)返回;ts.MoveToPoint(func.GetStartPoint(EnvDTE.vsCMPart.vsCMPartHeader));ts.MoveToPoint(func.GetEndPoint(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes), true);}}
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).
The closest I can get is highlighting the body with "Goto Brace Extend" 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.
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屋!