{"id":2683,"date":"2010-01-13T10:04:00","date_gmt":"2010-01-13T10:04:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2010\/01\/13\/searching-and-navigating-code-in-visual-studio-2010\/"},"modified":"2022-10-17T15:04:45","modified_gmt":"2022-10-17T22:04:45","slug":"searching-and-navigating-code-in-visual-studio-2010","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/searching-and-navigating-code-in-visual-studio-2010\/","title":{"rendered":"Searching and Navigating Code in Visual Studio 2010"},"content":{"rendered":"<p>Every developer knows that navigating code is vital to happy and productive coding. We\u2019ve added several new features for code search and navigation in Visual Studio 2010, including Navigate To and an improved Call Hierarchy, to complement search staples like the Find and Replace dialog and Incremental Search. With such a wide variety of options, we thought it would help to describe many of VS 2010\u2019s code search and navigation features, from old favorites to new additions, in one place:<\/p>\n<h3>Find and Replace<\/h3>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/clip_image001_2.png\"><img decoding=\"async\" title=\"Find and Replace\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/clip_image001_thumb.png\" alt=\"Find and Replace\" width=\"180\" height=\"240\" align=\"left\" border=\"0\" \/><\/a><\/p>\n<p>The <strong>Find and Replace<\/strong> dialog provides your basic search functionality. It comes in three flavors:<\/p>\n<ol>\n<li>\u00b7 <strong>Quick Find (Ctrl+F):<\/strong> Optimized for smaller searches, Quick Find is best for searching open documents for a string or expression. It also provides basic options for search scope, partial word matching, case sensitivity, searching up vs. down, and use of regular expressions or wildcards in searches.<\/li>\n<\/ol>\n<p>\u00b7 <strong>Find in<\/strong> <strong>Files (Ctrl+Shift+F):<\/strong> A more robust option, Find in Files is better for searching entire projects or solutions. Unlike Quick Find, Find in Files can list search results in the Find Results window and has additional options to specify which file extensions to search.<\/p>\n<p>\u00b7 <strong>Find Symbol<\/strong> <strong>(Alt+F12):<\/strong> Find Symbol allows you to search for symbols, including objects (namespaces, types, interfaces, enumerations, etc.) and members (classes, properties, methods, events, constants, variables, etc.).<\/p>\n<p>Want to use the Find feature without the dialog?\u00a0 <strong>Find Next (F3)<\/strong> will take you to the next occurrence of the text in the toolbar\u2019s Find combo box, which is usually your most recent search term.\u00a0 To start a new search, just select your desired text in the editor and use <strong>Find Next Selected (Ctrl+F3)<\/strong> to jump to the next occurrence of that text.<\/p>\n<p>We\u2019ve also heard feedback that the default Find highlight color, currently a pale blue, is difficult to see and makes it hard to quickly find the results of your search.\u00a0 Good news:\u00a0 we\u2019ve updated that color since Beta 2, so it will be a darker blue and hopefully easier to see in the Visual Studio 2010 RC and RTM.\u00a0 For Beta 2, you can change the highlight color in Tools-&gt;Options-&gt;Environment-&gt;Fonts and Colors by updating the background color for \u201cInactive Selected Text.\u201d\u00a0 For RC and RTM, you\u2019ll be able to customize the Find highlight using the background color for \u201cSelected Text.\u201d<\/p>\n<h3>Incremental Search<\/h3>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Incremental%20Search_2.png\"><img decoding=\"async\" title=\"Incremental Search\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/Incremental20Search_thumb.png\" alt=\"Incremental Search\" width=\"464\" height=\"144\" border=\"0\" \/><\/a> <\/strong><\/p>\n<p><strong>Incremental Search (Ctrl+I)<\/strong> is fast, lightweight, and interactive, allowing you to search for partial words and refine your search in real time. It uses very little screen real estate, doesn\u2019t cover up your code, and is great for quickly finding a piece of code in your current file.\u00a0 To use Incremental Search, just press Ctrl+I and start typing.\u00a0 Your search term will appear in the status bar at the bottom of the screen and your search will update as you type.\u00a0 Press Ctrl+I again to move to the next result and Enter or Escape to end the search.<\/p>\n<h3>Navigate To<\/h3>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Navigate%20To_2.png\"><img decoding=\"async\" title=\"Navigate To\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/Navigate20To_thumb.png\" alt=\"Navigate To\" width=\"464\" height=\"389\" border=\"0\" \/><\/a> <\/strong><\/p>\n<p><strong>Navigate To (Ctrl+comma)<\/strong>, new for Visual Studio 2010, is a powerful way to search, especially when you\u2019re not sure exactly what you\u2019re looking for. It helps you locate items in your code by using &#8220;fuzzy&#8221; search capabilities. For example, if you type Foo Bar instead of FooBar, Navigate To will still return useful results. It\u2019s a smart, incremental search that refines as you type and will find any symbols (e.g. file, type, and member names) matching your search terms.<\/p>\n<h3>Call Hierarchy<\/h3>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Call%20Hierarchy_2.png\"><img decoding=\"async\" title=\"Call Hierarchy\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/Call20Hierarchy_thumb.png\" alt=\"Call Hierarchy\" width=\"464\" height=\"130\" border=\"0\" \/><\/a> <\/strong><\/p>\n<p><strong>Call Hierarchy (Ctrl+ K, Ctrl+T)<\/strong>, or right-click and choose \u201cView Call Hierarchy\u201d, helps you understand the flow of code execution in more complex solutions and projects (C# only). Invoking Call Hierarchy on a method, property, indexer, or constructor in the source code shows you a tree of all the calls to and from that method, property, etc. Each method, property, and constructor in the Calls To and Calls From nodes can also be expanded into its own Calls To and Calls From sub-nodes. Call Hierarchy is great for navigating by code path or understanding relationships between functions.<\/p>\n<h3>Go To Definition<\/h3>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/clip_image007_2.png\"><img decoding=\"async\" title=\"Go To Definition\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/clip_image007_thumb.png\" alt=\"Go To Definition\" width=\"225\" height=\"186\" border=\"0\" \/><\/a><\/p>\n<p><strong>Go To Definition (F12)<\/strong> does what its name suggests: it takes you to the definition of a given symbol. It works for a variety of symbols, including methods, types, classes, members, and more. It\u2019s great for diving into implementation details, especially when reading code.<\/p>\n<h3>Navigate Backward\/Forward<\/h3>\n<p><strong><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Navigate%20Forward%20and%20Backward_2.png\"><img decoding=\"async\" title=\"Navigate Forward and Backward\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/Navigate20Forward20and20Backward_thumb.png\" alt=\"Navigate Forward and Backward\" width=\"464\" height=\"38\" border=\"0\" \/><\/a> <\/strong><\/p>\n<p><strong>Navigate Backward (Ctrl+minus)<\/strong> and <strong>Navigate Forward (Ctrl+Shift+minus)<\/strong> allow you to quickly move between places you\u2019ve already been in your code. For example, say you just used Go To Definition and now you want to go back to where you came from. It\u2019s easy \u2013 just use Navigate Backward. If you\u2019re interested in exactly how this works or how we determine exactly where to navigate you back to, check out <a href=\"https:\/\/learn.microsoft.com\/en-us\/archive\/blogs\/saraford\/did-you-know-how-to-navigate-forward-and-backwards-in-the-editor-all-because-of-go-back-markers-041\">Sara Ford\u2019s blog post<\/a> for details.<\/p>\n<h4>Highlight References<\/h4>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/clip_image010_2.png\"><img decoding=\"async\" title=\"Highlight References\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/clip_image010_thumb.png\" alt=\"Highlight References\" width=\"460\" height=\"150\" border=\"0\" \/><\/a><\/p>\n<p><strong>Highlight References<\/strong> is another new feature in Visual Studio 2010 (C# and VB only). Any time you place the blinking caret on a symbol, Visual Studio will automatically highlight all instances of that symbol for you. So what does this have to do with navigation? You can actually cycle through these highlighted references \u2013 just use Ctrl+Shift+up arrow and Ctrl+Shift+down arrow to move to the previous or next highlighted symbol.<\/p>\n<p>All of these are available in VS 2010 Beta 2, so I\u2019d encourage you to try them out, especially the new-for-VS 2010 Navigate To and Call Hierarchy features. Like what you see? Have suggestions for improvements? Want to share your favorite navigation tips &amp; tricks? Please leave a comment and let us know!<\/p>\n<p>Brittany Behrens\nProgram Manager, Visual Studio Editor Team<\/p>\n<div id=\"authorBottom\">\n<p><img decoding=\"async\" title=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/01\/clip_image002_3.jpg\" alt=\"clip_image002\" width=\"50\" height=\"66\" align=\"left\" border=\"0\" \/>I\u2019m Brittany, a Program Manager on the Visual Studio Editor team.\u00a0 Some of you may recognize me from <a href=\"http:\/\/connect.microsoft.com\/VisualStudio\"><span style=\"color: #366df4;\">Connect bugs<\/span><\/a> or as the main voice of <a href=\"https:\/\/twitter.com\/VSEditor\"><span style=\"color: #366df4;\">@VSEditor on Twitter<\/span><\/a>, and I\u2019m responsible for a variety of Editor features.\u00a0 I love hearing from customers, so please let me know what you think!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Every developer knows that navigating code is vital to happy and productive coding. We\u2019ve added several new features for code search and navigation in Visual Studio 2010, including Navigate To and an improved Call Hierarchy, to complement search staples like the Find and Replace dialog and Incremental Search. With such a wide variety of options, [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[5,185,13],"class_list":["post-2683","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-csharp","tag-node-js","tag-visual-studio-2010"],"acf":[],"blog_post_summary":"<p>Every developer knows that navigating code is vital to happy and productive coding. We\u2019ve added several new features for code search and navigation in Visual Studio 2010, including Navigate To and an improved Call Hierarchy, to complement search staples like the Find and Replace dialog and Incremental Search. With such a wide variety of options, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/2683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=2683"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/2683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=2683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=2683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=2683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}