没有一种简单的方法可以

没有一种简单的方法可以

本文介绍了有没有一种简单的方法可以直接跳转到文件中的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 Visual Studio 2012,在文件中导航很困难.我希望能够做的是在文件中输入一个或多个类、方法、字段或属性的字符,然后直接跳到该行.例如,如果我有代码:

I just installed Visual Studio 2012 and am having a hard time navigating within a file. What I'd like to be able to do is type in one or more characters of a class, method, field or property within a file and jump right to that line. For example, if I had the code:

public class Foo
{
   public void Bar()
   {

   }
}

我希望能够点击键盘快捷键,输入Ba"并直接跳转到 Foo 类的 Bar 方法.

I'd like to be be able to hit a keyboard shortcut, type "Ba" and jump right to the Bar method of the Foo class.

在 VS2008 和 VS2010 中,我使用 USysWare 的 DPack 使用 + 键盘快捷键.但是,似乎没有适用于 VS2012 的此插件版本,至少目前还没有.

In VS2008 and VS2010, I used USysWare's DPack to do this using the + keyboard shortcut. However, there does not appear to be a version of this plugin for VS2012, at least not yet.

我确实找到了 + 快捷键来搜索解决方案,这对于跳转到特定文件似乎很有效(类似于 DPack 的 + 快捷方式),但是我正在寻找可以在当前打开的文件中搜索代码的东西.

I did find the + shortcut key to search the solution, which seems to work fairly well for jumping to a specific file (similar to DPack's + shortcut), however I'm looking for something that will search code within the currently opened file.

顺便说一句,我目前使用的是 VS2012 Express Edition,但是当我有时间下载并设置它时将升级到 VS2012 Pro.我相信这些版本之间存在一些细微差别,因此我对适用于其中一个或两者的答案很感兴趣.

BTW, I'm currently using VS2012 Express Edition, but will be upgrading to VS2012 Pro when I have the time to download it and set it up. I believe there's some minor differences between these versions, so I'm interested in answers that apply to either or both.

推荐答案

这里是我经过一些研究后发现的总结.

So here is a summary of what I've found out after some research.

DPack for Visual Studio 2012:目前处于测试阶段,但可以使用完全没问题.由于这是一个插件,它不会在 Visual Studio 的 Express Edition 上运行.

Ctrl+F:标准的 + 对话框已在 Visual Studio 2012 中完全重新发明,更像是一个内联搜索,在您键入时在您的文档中跳来跳去.它对于查找符号非常有用,但也可以在文档中查找任何匹配的文本,包括引用、字符串常量、注释等.因此,它可能不是快速直接跳转到符号的最佳方式.

Ctrl+F: The standard + dialog has been completely re-invented in Visual Studio 2012 and is more of an inline search, jumping around in your document as you type. It's fairly usable for finding symbols, but would also find any matching text in the document, including references, string constants, comments, whatever. For this reason, it's probably not the best way to quickly jump right to a symbol.

Ctrl+Comma:这也是一个新的 VS2012 功能,但是它在 Visual Studio Express Edition 中不可用.这使您可以快速找到解决方案中的符号.它工作得相当好,但对于较大的项目,它可能会导致信息过载.

Ctrl+Comma: This is also a new VS2012 feature, however it's not available in Visual Studio Express Edition. This allows you to quickly find a symbol within your solution. It works fairly well, though for larger projects it might be information overload.

Ctrl+分号:解决方案资源管理器现在允许您使用 + 快捷键按文件名进行过滤.这使得查找文件变得快速而简单,但不会在当前文件中搜索符号.这更类似于 DPack 的 + 功能.

Ctrl+Semicolon: The Solution Explorer now allows you to filter by filename using the + shortcut key. This makes finding files quick and easy, however will not search symbols within the current file. This is more analogous to DPack's + feature.

班级视图搜索:在班级视图模式下(++),您还可以在整个解决方案中搜索类名或符号.但是,似乎没有使用此搜索的键盘快捷键,您也不能只搜索当前打开的文件.此外,您必须输入您的查询并按 Enter 键以显示结果,而不仅仅是在您输入时进行过滤.

Class View Search: Within Class View mode (++), you can also search for class names or symbols within your entire solution. However, there does not appear to be a keyboard shortcut to use this search, nor can you just search the currently opened file. Also, you have to enter your query and press enter to display the results, rather than just filtering as you type.

类/方法下拉列表:与以前版本的 Visual Studio 一样,代码文件在显示当前文件中的类和方法的文件选项卡下方有下拉列表.这对于快速跳转到文档中的任何方法来说是相当不可用的,因为您首先需要选择定义符号的类,然后选择符号本身.此外,我找不到任何键盘快捷键,也没有一种简单的方法可以通过键入部分符号名称来过滤列表中的项目.

Class/Method Dropdowns: Like previous versions of Visual Studio, code files have dropdowns just below the file tabs that display classes and methods within the current file. This is fairly unusable for quickly jumping to any method in the document, as you would first need to select which class the symbol is defined in, and then select the symbol itself. Also, there's no keyboard shortcut that I could find, nor is there an easy way to filter the items in the list by typing part of the symbol name.

这篇关于有没有一种简单的方法可以直接跳转到文件中的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 05:08