{"id":15035,"date":"2017-04-20T23:33:32","date_gmt":"2017-04-21T07:33:32","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/?p=15035"},"modified":"2023-04-14T13:19:09","modified_gmt":"2023-04-14T13:19:09","slug":"c-code-editing-and-navigation-in-visual-studio","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/c-code-editing-and-navigation-in-visual-studio\/","title":{"rendered":"C++ Code Editing and Navigation in Visual Studio"},"content":{"rendered":"<p>Visual Studio comes packed with a set of productivity tools to make it easy for C++ developers to read, edit, and navigate through their code. In this blog post we will dive into these features and go over what they do. This post is part of a series aimed at new users to Visual Studio.<\/p>\n<p>This blog post goes over the following concepts:<\/p>\n<ol>\n<li><a href=\"#Reading\">Reading and Understanding Code<\/a>\n<ul>\n<li><a href=\"#reading-basic-features\"\">Basic Editor Features<\/a><\/li>\n<li><a href=\"#QuickInfo\">Quick Info and Parameter Info<\/a><\/li>\n<li><a href=\"#ScrollBarMapMode\">Scroll Bar Map Mode<\/a><\/li>\n<li><a href=\"#ClassView\">Class View<\/a><\/li>\n<li><a href=\"#GenerateGraphOfIncludes\">Generate Graph of Include Files<\/a><\/li>\n<li><a href=\"#CallHierarchy\">View Call Hierarchy<\/a><\/li>\n<li><a href=\"#PeekDef\">Peek Definition<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#Navigating\">Navigating Around Your Codebase<\/a>\n<ul>\n<li><a href=\"#OpenDoc\">Open Document<\/a><\/li>\n<li><a href=\"#ToggleHeader\">Toggle Header\/Code File<\/a><\/li>\n<li><a href=\"#SolutionExplorer\">Solution Explorer<\/a><\/li>\n<li><a href=\"#GoToDef\">Go To Definition \/ Declaration<\/a><\/li>\n<li><a href=\"#Find\">Find \/ Find in Files<\/a><\/li>\n<li><a href=\"#FAR\">Find All References<\/a><\/li>\n<li><a href=\"#NavBar\">Navigation Bar<\/a><\/li>\n<li><a href=\"#GoTo\">Go To<\/a><\/li>\n<li><a href=\"#QuickLaunch\">Quick Launch<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#Authoring\">Authoring and Refactoring Code<\/a>\n<ul>\n<li><a href=\"#authoring-basic-features\">Basic Editor Features<\/a><\/li>\n<li><a href=\"#ChangeTracking\">Change Tracking<\/a><\/li>\n<li><a href=\"#IntelliSense\">IntelliSense<\/a><\/li>\n<li><a href=\"#QuickFixes\">Quick Fixes<\/a><\/li>\n<li><a href=\"#Refactoring\">Refactoring Features<\/a><\/li>\n<li><a href=\"#EditorConfig\">Code Style Enforcement with EditorConfig<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#KeyboardShortcuts\">Keyboard Shortcut Reference<\/a><\/li>\n<li><a href=\"#Conclusion\">Conclusion<\/a><\/li>\n<\/ol>\n<p><a name=\"#Reading\"><\/a><\/p>\n<h3>Reading and Understanding Code<\/h3>\n<p>If you\u2019re like most developers, chances are you spend more time looking at code than modifying it. With that in mind, Visual Studio provides a suite of features to help you better visualize and understand your project.\n<a name=\"#ReadingBasicFeatures\"><\/a><\/p>\n<h4 id=\"reading-basic-features\">Basic Editor Features<\/h4>\n<p>Visual Studio automatically provides syntax colorization for your C++ code to differentiate between different types of symbols. Unused code (e.g. code under an <em>#if 0<\/em>) is more faded in color. In addition, <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/outlining\">outlines <\/a>are added around code blocks to make it easy to expand or collapse them.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/basic-features.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15045\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/basic-features.png\" alt=\"Basic editor features\" width=\"909\" height=\"463\" \/><\/a>\nIf there is an error in your code that will cause your build to fail, Visual Studio adds a red squiggle where the issue is occurring. If Visual Studio finds an issue with your code but the issue wouldn\u2019t cause your build to fail, you\u2019ll see a green squiggle instead. You can look at any compiler-generated warnings or errors in the <strong><em>Error List<\/em><\/strong> window.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/error-list.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-15055\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/error-list-1024x108.png\" alt=\"Error List window\" width=\"879\" height=\"93\" \/><\/a>\nIf you place your cursor over a curly brace, \u2018{\u2018 or \u2018}\u2019, Visual Studio highlights its matching counterpart.<\/p>\n<p>You can zoom in or out in the editor by holding down <em>Ctrl <\/em>and scrolling with your mouse wheel or selecting the zoom setting in the bottom left corner.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/zoom.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15065\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/zoom.png\" alt=\"Zooming in Visual Studio editor\" width=\"767\" height=\"192\" \/><\/a><\/p>\n<p>The <strong><em>Tools &gt; Options<\/em><\/strong> menu is the central location for Visual Studio options, and gives you the ability to configure a large variety of different features. It is worth exploring to tailor the IDE to your unique needs.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/tools-options.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15075\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/tools-options.png\" alt=\"Configuring settings in Visual Studio via Tools &gt; Options\" width=\"656\" height=\"319\" \/><\/a>\nYou can add line numbers to your project by going to <em>Text Editor &gt; All Languages &gt; General<\/em> or by searching for \u201cline num\u201d with <em>Quick Launch<\/em> <em>(Ctrl + Q)<\/em>. Line numbers can be set for all languages or for specific languages only, including C++.\n<a name=\"#QuickInfo\"><\/a><\/p>\n<h4>Quick Info and Parameter Info<\/h4>\n<p>You can hover over any variable, function, or other code symbol to get information about that symbol. For symbols that can be declared, <strong><em>Quick Info<\/em><\/strong> displays the declaration.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/quick-info.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15085\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/quick-info.png\" alt=\"Quick Info tooltip example\" width=\"350\" height=\"134\" \/><\/a>\nWhen you are writing out a call to a function, <strong><em>Parameter Info<\/em><\/strong> is invoked to clarify the types of parameters expected as inputs. If there is an error in your code, you can hover over it and Quick Info will display the error message. You can also find the error message in the <em>Error List <\/em>window.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/error-quick-info.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15086\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/error-quick-info.png\" alt=\"Quick Info tooltip displaying an error in Visual Studio\" width=\"1002\" height=\"123\" \/><\/a>\nIn addition, <em>Quick Info<\/em> displays any comments that you place just above the definition of the symbol that you hover over, giving you an easy way to check the documentation in your code.\n<a name=\"ScrollBarMapMode\"><\/a><\/p>\n<h4>Scroll Bar Map Mode<\/h4>\n<p>Visual Studio takes the concept of a scroll bar much further than most applications. With <strong><em>Scroll Bar Map Mode<\/em><\/strong>, you can scroll and browse through a file at the same time without leaving your current location, or click anywhere on the bar to navigate there. Even with <em>Map Mode<\/em> off, the scroll bar highlights changes made in the code in green (for saved changes) and yellow (for unsaved changes). You can turn on <em>Map Mode<\/em> in T<em>ools &gt; Options &gt; Text Editor &gt; All Languages &gt; Scroll Bars &gt; Use map mode for vertical scroll bar<\/em> or by searching for \u201cmap\u201d with <em>Quick Launch (Ctrl + Q)<\/em>.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/scroll-bar-map-mode.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15095\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/scroll-bar-map-mode.png\" alt=\"Using Scroll Bar Map Mode to view your code file at a glance\" width=\"600\" height=\"441\" \/><\/a>\n<a name=\"ClassView\"><\/a><\/p>\n<h4>Class View<\/h4>\n<p>There are several ways of visualizing your code. One example is <strong><em>Class View<\/em><\/strong>. You can open <em>Class View<\/em> from the <em>View <\/em>menu or by pressing <em>Ctrl + Shift + C<\/em>. <em>Class View <\/em>displays a searchable set of trees of all code symbols and their scope and parent\/child hierarchies, organized on a per-project basis. You can configure what <em>Class View<\/em> displays from <em>Class View Settings<\/em> (click the gear box icon at the top of the window).\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/class-view.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15105\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/class-view.png\" alt=\"The Class View window\" width=\"351\" height=\"327\" \/><\/a>\n<a name=\"GenerateGraphOfIncludes\"><\/a><\/p>\n<h4>Generate Graph of Include Files<\/h4>\n<p>To understand dependency chains between files, right-click while in any open document and choose <strong>Gen<em>erate graph of include files<\/em><\/strong>.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/generate-graph-include-files.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15115\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/generate-graph-include-files.png\" alt=\"Generate Graph of Include Files feature\" width=\"664\" height=\"332\" \/><\/a>\nYou also have the option to save the graph for later viewing.\n<a name=\"CallHierarchy\"><\/a><\/p>\n<h4>View Call Hierarchy<\/h4>\n<p>You can right-click any function call to view a recursive list of its call hierarchy (both functions that call it, and functions that it calls). Each function in the list can be expanded in the same way. For more information, see <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/reference\/call-hierarchy\">Call Hierarchy<\/a>.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/call-hierarchy.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15116\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/call-hierarchy.png\" alt=\"View Call Hierarchy feature\" width=\"626\" height=\"393\" \/><\/a>\n<a name=\"PeekDef\"><\/a><\/p>\n<h4>Peek Definition<\/h4>\n<p>You can check out the definition of a variable or function at a glance, inline, by right-clicking it and choosing <strong><em>Peek Definition<\/em><\/strong>, or pressing <em>Alt+F12 <\/em>with the cursor over that symbol. This is a quick way to learn more about the symbol without having to leave your current position in the editor.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/peek-definition.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15126\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/peek-definition.png\" alt=\"Use Peek Definition to get a quick look at where and how a code symbol is defined. \" width=\"427\" height=\"407\" \/><\/a>\n<a name=\"Navigating\"><\/a><\/p>\n<h3>Navigating Around Your Codebase<\/h3>\n<p>Visual Studio provides a suite of tools to allow you to navigate around your codebase quickly and efficiently.\n<a name=\"OpenDoc\"><\/a><\/p>\n<h4>Open Document<\/h4>\n<p>Right-click on an <em>#include<\/em> directive in your code and choose <em>Open Document<\/em>, or press <em>Ctrl+Shift+G<\/em> with the cursor over that line, to open the corresponding document.\n<a name=\"ToggleHeader\"><\/a><\/p>\n<h4>Toggle Header\/Code File<\/h4>\n<p>You can switch between a header file and its corresponding source file or vice versa, by right-clicking anywhere in your file and choosing <strong><em>Toggle Header \/ Code File<\/em><\/strong> or by pressing its corresponding keyboard shortcut: <em>Ctrl+K, Ctrl+O<\/em>.\n<a name=\"SolutionExplorer\"><\/a><\/p>\n<h4>Solution Explorer<\/h4>\n<p><strong><em>Solution Explorer<\/em><\/strong> is the primary means of managing and navigating between files in your solution. You can navigate to any file by clicking it in <em>Solution Explorer<\/em>. By default, files are grouped by the projects that they appear in. To change this default view, click the <em>Solutions and Folders<\/em> button at the top of the window to switch to a folder-based view.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/solution-explorer-2.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15175\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/solution-explorer-2.png\" alt=\"Solution Explorer window\" width=\"722\" height=\"640\" \/><\/a>\n<a name=\"GoToDef\"><\/a><\/p>\n<h4>Go To Definition\/Declaration<\/h4>\n<p>You can navigate to the definition of a code symbol by right-clicking it in the editor and choosing <strong><em>Go To Definition<\/em><\/strong>, or pressing <em>F12<\/em>. You can navigate to a declaration similarly from the right-click context menu, or by pressing <em>Ctrl+F12<\/em>.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/go-to-def.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15155\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/go-to-def.png\" alt=\"Navigating to a definition or declaration via the editor context menu\" width=\"650\" height=\"257\" \/><\/a>\n<a name=\"Find\"><\/a><\/p>\n<h4>Find \/ Find in Files<\/h4>\n<p>You can run a text search for anything in your solution with <strong><em>Find<\/em> <\/strong><em>(Ctrl+F)<\/em> or <strong><em>Find in Files<\/em> <\/strong><em>(Ctrl+Shift+F)<\/em>.<\/p>\n<p>Find can be scoped to a selection, the current document, all open documents, the current project, or the entire solution, and supports regular expressions. It also highlights all matches automatically in the IDE.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/find.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-15165\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/find-1024x399.png\" alt=\"Find (Ctrl + F)\" width=\"879\" height=\"343\" \/><\/a>\n<strong><em>Find in Files<\/em><\/strong> is a more sophisticated version of <em>Find <\/em>that displays a list of results in the <strong><em>Find Results<\/em><\/strong> window. It can be configured even further than <em>Find<\/em>, such as by allowing you to search external code dependencies, filter by filetypes, and more. You can organize <em>Find <\/em>results in two windows or append results from multiple searches together in the <em>Find Results<\/em> window. Individual entries in the <em>Find Results<\/em> window can also be deleted if they are not desired.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/find-in-files.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15185\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/find-in-files.png\" alt=\"Find in Files\" width=\"380\" height=\"552\" \/><\/a><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/find-results.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15195\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/find-results.png\" alt=\"Find Results window\" width=\"815\" height=\"163\" \/><\/a>\n<a name=\"FAR\"><\/a><\/p>\n<h4>Find All References<\/h4>\n<p><strong><em>Find All References<\/em><\/strong> displays a list of references to the chosen symbol. For more information on <em>Find All References<\/em>, check out our blog post, <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/11\/16\/find-all-references-re-designed-for-larger-searches\/\">Find All References Re-designed for Larger Searches<\/a>.\n<a name=\"NavBar\"><\/a><\/p>\n<h4>Navigation Bar<\/h4>\n<p>You can navigate to different symbols around your codebase by using the navbar that is above the editor window.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/navbar.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15196\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/navbar.png\" alt=\"navbar\" width=\"846\" height=\"225\" \/><\/a>\n<a name=\"GoTo\"><\/a><\/p>\n<h4>Go To<\/h4>\n<p><strong><em>Go To<\/em> <\/strong><em>(Ctrl + T) <\/em>is a code navigation feature that can be used to navigate to files, code symbols or line numbers. For more information, take a look at <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2016\/11\/16\/introducing-go-to-the-successor-to-navigate-to\/\">Introducing Go To, the Successor to Navigate To<\/a>.\n<a name=\"QuickLaunch\"><\/a><\/p>\n<h4>Quick Launch<\/h4>\n<p><strong><em>Quick Launch<\/em><\/strong> makes it easy to navigate to any window, tool, or setting in Visual Studio. Simply type <em>Ctrl+Q <\/em>or click on the search box in the top-right corner of the IDE and search for what you are looking for.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/quick-launch.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15205\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/quick-launch.png\" alt=\"Quick Launch search feature\" width=\"554\" height=\"174\" \/><\/a>\n<a name=\"Authoring\"><\/a><\/p>\n<h3>Authoring and refactoring code<\/h3>\n<p>Visual Studio provides a suite of tools to help you author, edit, and refactor your code.\n<a name=\"AuthoringBasicFeatures\"><\/a><\/p>\n<h4 id=\"authoring-basic-features\">Basic Editor Features<\/h4>\n<p>You can easily move lines of code up and down by selecting them, holding down <em>Alt<\/em>, and pressing the <em>Up\/Down arrow keys<\/em>.<\/p>\n<p>To save a file, press the <em><strong>Save<\/strong><\/em> button at the top of the IDE, or press <em>Ctrl+S<\/em>. Generally though, it\u2019s a good idea to save all your changed files at one time by using <strong><em>Save All<\/em><\/strong> <em>(Ctrl+Shift+S)<\/em>.\n<a name=\"ChangeTracking\"><\/a><\/p>\n<h4>Change Tracking<\/h4>\n<p>Any time you make a change to a file, a yellow bar appears on the left to indicate that unsaved changes were made. When you save the file, the bar turns green.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/change-tracking.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15206\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/change-tracking.png\" alt=\"Change tracking in the editor\" width=\"844\" height=\"411\" \/><\/a>\nThe green and yellow bars are preserved as long as the document is open in the editor. They represent the changes that were made since you last opened the document.\n<a name=\"IntelliSense\"><\/a><\/p>\n<h4>IntelliSense<\/h4>\n<p><strong><em>IntelliSense<\/em><\/strong> is a powerful code completion tool that suggests symbols and code snippets for you as you type. C++ <em>IntelliSense<\/em> in Visual Studio runs in real time, analyzing your codebase as you update it and providing contextual recommendations based on the characters of a symbol that you\u2019ve typed. As you type more characters, the list of recommended results narrows down.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/intellisense-gif.gif\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15216\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/intellisense-gif.gif\" alt=\"How IntelliSense works in Visual Studio\" width=\"600\" height=\"265\" \/><\/a>\nIn addition, some symbols are omitted automatically to help you narrow down on what you need. For example, when accessing a class object\u2019s members from outside the class, you will not be able to see private members by default, or protected members (if you are not in the context of a child class).<\/p>\n<p>After you have picked out the symbol you want to add from the drop-down list, you can autocomplete it with <em>Tab<\/em>, <em>Enter<\/em>, or one of the other commit characters (by default: <em>{}[]().,:;+-*\/%&amp;|^!=?@#\\<\/em>).<\/p>\n<p><strong>TIP: <\/strong>If you want to change the set of characters that can be used to complete <em>IntelliSense<\/em> suggestions, search for \u201cIntelliSense\u201d in <em>Quick Launch (Ctrl + Q) <\/em>and choose the <em>Text Editor -&gt; C\/C++ -&gt; Advanced<\/em> option to open the <em>IntelliSense advanced settings<\/em> page. From there, edit <em>Member List Commit Characters<\/em> with the changes you want. If you find yourself accidentally committing results you didn\u2019t want or want a new way to do so, this is your solution.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/intellisense-settings-2.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15235\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/intellisense-settings-2.png\" alt=\"IntelliSense Advanced Settings\" width=\"726\" height=\"758\" \/><\/a>\nThe <em>IntelliSense <\/em>section of the advanced settings page also provides many other useful customizations. The <em>Member List Filter Mode<\/em> option, for example, has a dramatic impact on the kinds of <em>IntelliSense <\/em>autocomplete suggestions you will see. By default, it is set to <em>Fuzzy<\/em>, which uses a sophisticated algorithm to find patterns in the characters that you typed and match them to potential code symbols. For example, if you have a symbol called <em>MyAwesomeClass<\/em>, you can type &#8220;MAC&#8221; and find the class in your autocomplete suggestions, despite omitting many of the characters in the middle. The fuzzy algorithm sets a minimum threshold that code symbols must meet to show up in the list.<\/p>\n<p>If you don\u2019t like the fuzzy filtering mode, you can change it to <em>Prefix<\/em>, <em>Smart<\/em>, or <em>None<\/em>. While <em>None <\/em>won\u2019t reduce the list at all, <em>Smart <\/em>filtering displays all symbols containing substrings that match what you typed. <em>Prefix<\/em> filtering on the other hand purely searches for strings that begin with what you typed. These settings give you many options to define your <em>IntelliSense <\/em>experience, and it\u2019s worth trying them out to see what you prefer.<\/p>\n<p><em>IntelliSense <\/em>doesn\u2019t just suggest individual symbols. Some <em>IntelliSense <\/em>suggestions come in the form of code snippets, which provide a basic example of a code construct. Snippets are easily identified by the square box icon beside them. In the following screenshot, \u201c<em>while<\/em>\u201d is a code snippet that automatically creates a basic <em>while <\/em>loop when it is committed. You can choose to toggle the appearance of snippets in the advanced settings page.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/while-snippet.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15236\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/while-snippet.png\" alt=\"Code snippet for while loop\" width=\"524\" height=\"76\" \/><\/a>\nVisual Studio 2017 provides two new <em>IntelliSense <\/em>features to help you narrow down the total number of autocomplete recommendations: <em>Predictive IntelliSense<\/em>, and <em>IntelliSense filters<\/em>. Check out our blog post, <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/c-intellisense-improvements-predictive-intellisense-filtering\/\">C++ IntelliSense Improvements \u2013 Predictive IntelliSense &amp; Filtering<\/a>, to learn more about how these two features can improve your productivity.<\/p>\n<p>If you ever find yourself in a situation where the list of results suggested by <em>IntelliSense <\/em>doesn\u2019t match what you\u2019re looking for, and you already typed some valid characters beforehand, you can choose to unfilter the list by clicking the <em>Show more results<\/em> button in the bottom left corner of the drop-down list&#8211;which looks like a plus (+)\u2014or by pressing Ctrl + J. This will refresh the suggestions, and add some new entries. If you\u2019re using <em>Predictive IntelliSense<\/em>, which is an optional mode that uses a stricter filtering mechanism than usual, you may find the list expansion feature even more useful.\n<a name=\"QuickFixes\"><\/a><\/p>\n<h4>Quick Fixes<\/h4>\n<p>Visual Studio sometimes suggests ways to improve or complete your code. This comes in the forms of some lightbulb pop-ups called <em>Quick Fixes<\/em>. For example, if you declare a class in a header file, Visual Studio will suggest that it can declare a definition for it in a separate .cpp file.\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/quick-fixes.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-15245\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/9\/2019\/02\/quick-fixes.png\" alt=\"Quick Fixes\" width=\"408\" height=\"132\" \/><\/a>\n<a name=\"Refactoring\"><\/a><\/p>\n<h4>Refactoring Features<\/h4>\n<p>Do you have a codebase that you\u2019re not happy with? Have you found yourself needing to make sweeping changes but are afraid of breaking your build or feel like it will take too long? This is where the C++ refactoring features in Visual Studio come in. We provide a suite of tools to help you make code changes. Currently, Visual Studio supports the following refactoring operations for C++:<\/p>\n<ul>\n<li>Rename<\/li>\n<li>Extract Function<\/li>\n<li>Change Function Signature<\/li>\n<li>Create Declaration\/Definition<\/li>\n<li>Move Function Definition<\/li>\n<li>Implement Pure Virtuals<\/li>\n<li>Convert to Raw String Literal<\/li>\n<\/ul>\n<p>Many of these features are called out in our announcement blog post, <a href=\"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2014\/11\/14\/all-about-c-refactoring-in-visual-studio-2015-preview\/\">All about C++ Refactoring in Visual Studio<\/a>. Change Function Signature was added afterward, but functions exactly as you\u2019d expect \u2013 it allows you to change the signature of a function and replicate changes throughout your codebase. You can access the various refactoring operations by right-clicking somewhere in your code or using the Edit menu. It\u2019s also worth remembering <em>Ctrl + R, Ctrl + R<\/em> to perform symbol renames; it\u2019s easily the most common refactoring operation.<\/p>\n<p>In addition, check out the <a href=\"https:\/\/marketplace.visualstudio.com\/\">C++ Quick Fixes<\/a> extension, which adds a host of other tools to help you change your code more efficiently.<\/p>\n<p>For additional information, check our documentation on <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/ide\/writing-and-refactoring-code-cpp\">Writing and refactoring code in C++<\/a>.\n<a name=\"EditorConfig\"><\/a><\/p>\n<h4>Code Style Enforcement with EditorConfig<\/h4>\n<p>Visual Studio 2017 comes with built-in support for <a href=\"http:\/\/editorconfig.org\/\">EditorConfig<\/a>, a popular code style enforcement mechanism. You can create <em>.editorconfig<\/em> files and place them in different folders of your codebase, applying code styles to those folders and all subfolders below them. An <em>.editorconfig<\/em> file supersedes any other <em>.editorconfig<\/em> files in parent folders and overwrites any formatting settings configured via <em>Tools &gt; Options<\/em>. You can set rules around tabs vs. spaces, indent size, and more. <em>EditorConfig <\/em>is particularly useful when you are working on a project as part of a team, such as when a developer wants to check in code formatted with tabs instead of spaces, when your team normally uses spaces. <em>EditorConfig <\/em>files can easily be checked in as part of your code repo to enforce your team style.<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/create-portable-custom-editor-options\">Learn more about EditorConfig support in Visual Studio<\/a>\n<a name=\"KeyboardShortcuts\"><\/a><\/p>\n<h3>Keyboard Shortcut Reference<\/h3>\n<p>For a full set of default key bindings for Visual Studio C++ developers, take a look at our <a href=\"http:\/\/vs2017poster.azurewebsites.net\/vskeyboard.pdf\">Visual Studio 2017 Keyboard Shortcut Reference<\/a>.\n<a name=\"Conclusion\"><\/a><\/p>\n<h3>Conclusion<\/h3>\n<p>Lastly, you can find additional resources on how to use Visual Studio in our official documentation pages at <a href=\"https:\/\/docs.microsoft.com\/\">docs.microsoft.com<\/a>. In particular, for developer productivity, we have the following set of articles available:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/writing-code-in-the-code-and-text-editor\">Writing Code in the Code and Text Editor<\/a> \u2013 goes over more features in this area.<\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/ide\/writing-and-refactoring-code-cpp\">Writing and refactoring code (C++)<\/a> \u2013 provides some C++ productivity tips.<\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/finding-and-using-visual-studio-extensions\">Finding and Using Visual Studio Extensions<\/a> \u2013 many community contributors submit both free and paid extensions that can improve your development experience.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Visual Studio comes packed with a set of productivity tools to make it easy for C++ developers to read, edit, and navigate through their code. In this blog post we will dive into these features and go over what they do. This post is part of a series aimed at new users to Visual Studio. [&hellip;]<\/p>\n","protected":false},"author":1063,"featured_media":35994,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-15035","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus"],"acf":[],"blog_post_summary":"<p>Visual Studio comes packed with a set of productivity tools to make it easy for C++ developers to read, edit, and navigate through their code. In this blog post we will dive into these features and go over what they do. This post is part of a series aimed at new users to Visual Studio. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/15035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/1063"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=15035"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/15035\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=15035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=15035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=15035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}