Visual Studio Code C++ extension: Nov 2019 update
The November 2019 update of the Visual Studio Code C++ extension is now available. This latest release comes with a big list of improvements: Find All References, Rename Symbol refactoring, support for localization, new navigation breadcrumb controls, and improvements to the Outline view to name a few. For a more detailed list of changes, check out our release notes on GitHub.
Find All References
Now you can right-click on a C++ symbol anywhere in your file and select Find All References from the context menu. This will search for all instances of a symbol inside the current workspace. Depending on the symbol selected, the search will show at first a progress bar while it is searching for all instances of that symbol or directly display the results in the References Results view.
The References Results window will display its results into two panes – the top one will show the confirmed results: those instances where IntelliSense confirmed that the text match is also a semantic match for the symbol you searched for. The bottom pane will show all other text matches, categorized by the location where they were found e.g. in a string, in a comment or inside an inactive macro block.
You can clear individual results from the list or all the results by using the controls in the References Results window. If you clear all the results, you can also review the list of previous searches and you have the option to rerun them.
Rename Symbol refactoring
The Rename symbol operation is unquestionably the most requested refactoring tool by C++ developers. With the November 2019 release, we’re happy to announce that this functionality is now supported in the C++ extension. Whether you directly invoke Rename via its keyboard shortcut F2, or select it from the context menu, you will be prompted with a textbox that allow you to introduce the new symbol name.
If all the references to the symbol can be confirmed, the rename operation is performed immediately after you confirm the new name for your symbol. Otherwise, a list of candidates is displayed in the C++ Rename Results window. Before committing the refactor operation, you now have the option to include additional candidates for rename that were found as text matches (not semantic matches) during the search e.g. in strings, comments or inactive blocks.
To confirm a rename operation, click on the “Commit Rename” action on the “Pending rename” title bar.
With this version, the C++ extension UI, command names, tooltips, warnings, and errors are all localized and will respect your choice of language that you selected via the “Configure Display Language” command.
Navigation breadcrumbs in C++ editors and Outline view improvements
The C++ editor now includes in its navigation breadcrumbs the symbol path up to the cursor position in addition to the file path. To quickly navigate to the Breadcrumbs UI, you can run the “Focus Breadcrumbs” command (default keyboard shortcut for this command is Ctrl+Shift+. or Command+Shift+.). To switch between the different elements in the UI, use the Left and Right keyboard shortcuts (which default to Ctrl+Left Arrow/Right Arrow or Option+Left Arrow/Right Arrow).
You can also customize the appearance of breadcrumbs. If you have very long paths or are only interested in either file paths or symbol paths, you can configure breadcrumbs.filePath and breadcrumbs.symbolPath settings (both support on, off, and last). By default, breadcrumbs show icons, but you can remove that by setting breadcrumbs.icons to false.
New in this release also is the ability for Outline view (as well as the new Breadcrumb section) to list the C++ symbols as a hierarchy rather than a flat list.
What do you think?
Download the C++ extension for Visual Studio Code today, give it a try, and let us know what you think. If you run into any issues, or have any suggestions, please report them in the Issues section of our GitHub repository. You can also join our Insiders program and get access to early builds of our releaseby going to File > Preferences > Settings (Ctrl+,) and under Extensions > C/C++, change the “C_Cpp: Update Channel” to “Insiders”.