Skip to content

Commit cb1a243

Browse files
authored
Merge pull request MicrosoftDocs#823 from mikeblome/mb-clangformat
Small update for ClangFormat support
2 parents eeb0d91 + 6d19f2a commit cb1a243

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed
108 KB
Loading

docs/ide/writing-and-refactoring-code-cpp.md

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
title: "Writing and refactoring code (C++) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/27/2017"
4+
ms.date: "04/30/2018"
5+
ms.reviewer: ""
6+
ms.suite: ""
57
ms.technology: ["cpp-ide"]
68
ms.topic: "conceptual"
79
dev_langs: ["C++"]
@@ -12,42 +14,46 @@ ms.workload: ["cplusplus"]
1214
---
1315
# Writing and refactoring code (C++)
1416

15-
The Visual C++ code editor and IDE provide many coding aids. Some are unique to C++, and some are essentially the same for all Visual Studio languages. For more information about the shared features, see [Writing Code in the Code and Text Editor](/visualstudio/ide/writing-code-in-the-code-and-text-editor). Options for enabling and configuring C++-specific features are located in the [Text Editor C++ Advanced](/visualstudio/ide/reference/options-text-editor-c-cpp-advanced) dialog (**Tools | Options | Text Editor | C/C++ | Advanced** or type "C++ Advanced" in **Quick Launch**). After choosing which option you want to set, you can get more help by pressing **F1** when the dialog is in focus. For general code formatting options, type `Editor C++` into **QuickLaunch**.
17+
The Visual C++ code editor and IDE provide many coding aids. Some are unique to C++, and some are essentially the same for all Visual Studio languages. For more information about the shared features, see [Writing Code in the Code and Text Editor](/visualstudio/ide/writing-code-in-the-code-and-text-editor). Options for enabling and configuring C++-specific features are located under **Tools | Options | Text Editor | C/C++**. After choosing which option you want to set, you can get more help by pressing **F1** when the dialog is in focus. For general code formatting options, type `Editor C++` into **QuickLaunch**.
1618

1719
Experimental features, which may or may not be included in a future version of Visual Studio, are found in the [Text Editor C++ Experimental](/visualstudio/ide/reference/options-text-editor-c-cpp-experimental) dialog. In Visual Studio 2017 you can enable **Predictive Intellisense** in this dialog.
1820

19-
## Adding new code
21+
## Adding new files
2022

21-
After creating a project, you can start coding in the files that were generated for you. To add new files, right-click on the project node in Solution Explorer and choose **Add | New**.
23+
To add new files to a project, right-click on the project node in Solution Explorer and choose **Add | New**.
2224

23-
To set formatting options such as indents, brace completion, and colorization, type `C++ Formatting` into the **QuickLaunch** window.
25+
## Formatting options
2426

25-
### IntelliSense
27+
To set formatting options such as indents, brace completion, and colorization, type "C++ Formatting" into the **QuickLaunch** window. Visual Studio 2017 version 15.7 and later supports ClangFormat. You can configure it in the [C/C++ Formatting Property Page](/visualstudio/ide/reference/options-text-editor-c-cpp-formatting) under **Tools | Options | Text Editor | C/C++ | Formatting**.
28+
29+
![C++ formatting options](media/cpp-formatting-options.png)
30+
31+
## IntelliSense
2632

2733
IntelliSense is the name for a set of features that provide inline information about members, types, and function overloads. The following illustration shows the member list drop-down that appears as you type. You can press the tab key to enter the selected item text into your code file.
2834

2935
![C++ member list drop down](../ide/media/vs2015_cpp_statement_completion.png "vs2015_cpp_statement_completion")
3036

3137
For complete information see [Visual C++ Intellisense](/visualstudio/ide/visual-cpp-intellisense).
3238

33-
### Insert Snippets
39+
## Insert Snippets
3440

3541
A snippet is a predefined piece of source code. Right-click on a single point or on selected text to either insert a snippet or surround the selected text with the snippet. The following illustration shows the three steps to surround a selected statement with a for loop. The yellow highlights in the final image are editable fields that you access with the tab key. For more information, see [Code Snippets](/visualstudio/ide/code-snippets).
3642

3743
![Visual C++ Insert Snippet Drop-down](../ide/media/vs2015_cpp_surround_with.png "vs2015_cpp_surround_with")
3844

39-
### Add Class
45+
## Add Class
4046

4147
Add a new class from the **Project** menu by using the Class Wizard.
4248

4349
![Add New Class in Visual C++](../ide/media/vs2015_cpp_add_class.png "vs2015_cpp_add_class")
4450

45-
### Class Wizard
46-
47-
Modify or examine an existing class, or add a new class, using the Class Wizard. For more information, see [Adding Functionality with Code Wizards (C++)](../ide/adding-functionality-with-code-wizards-cpp.md).
51+
You can also use Class Wizard to modify or examine an existing class.
4852

4953
![Visual C++ Class Wizard](../ide/media/vs2015_cpp_class_wizard.png "vs2015_cpp_class_wizard")
5054

55+
For more information, see [Adding Functionality with Code Wizards (C++)](../ide/adding-functionality-with-code-wizards-cpp.md).
56+
5157
## Refactoring
5258

5359
Refactorings are available under the Quick Action context menu, or by clicking on a [light bulb](/visualstudio/ide/perform-quick-actions-with-light-bulbs) in the editor. Some are also found in the **Edit > Refactor** menu. These features include:
@@ -64,61 +70,61 @@ Refactorings are available under the Quick Action context menu, or by clicking o
6470

6571
Visual C++ shares many code navigation features with other languages. For more information, see [Navigating Code](/visualstudio/ide/navigating-code) and [Viewing the Structure of Code](/visualstudio/ide/viewing-the-structure-of-code).
6672

67-
### QuickInfo
73+
## QuickInfo
6874

6975
Hover over a variable to see its type information.
7076

7177
![Visual C++ QuickInfo](../ide/media/vs2015_cpp_quickinfo.png "vs2015_cpp_quickInfo")
7278

73-
### Open document (Navigate to header)
79+
## Open document (Navigate to header)
7480

7581
Right click on the header name in an `#include` directive and open the header file.
7682

7783
![Visual C++ Open Document menu option](../ide/media/vs2015_cpp_open_document.png "vs2015_cpp_open_document")
7884

79-
### Peek Definition
85+
## Peek Definition
8086

8187
Hover over a variable or function declaration, right-click, then choose **Peek Definition** to see an inline view of its definition. For more information, see [Peek Definition (Alt+F12)](/visualstudio/ide/how-to-view-and-edit-code-by-using-peek-definition-alt-plus-f12).
8288

8389
![Visual C++ Peek Definition](../ide/media/vs2015_cpp_peek_definition.png "vs2015_cpp_peek_definition")
8490

85-
### Go To Definition
91+
## Go To Definition
8692

8793
Hover over a variable or function declaration, right-click, then choose **Go To Definition** to open the document where the object is defined.
8894

89-
### View Call Hierarchy
95+
## View Call Hierarchy
9096

9197
Right click on any function call and view a resursive list of all the functions that it calls, and all the functions that call it. Each function in the list can be expanded in the same way. For more information, see [Call Hierarchy](/visualstudio/ide/reference/call-hierarchy).
9298

9399
![Visual C++ Call Hierarchy](../ide/media/vs2015_cpp_call_hierarchy.png "vs2015_cpp_call_hierarchy")
94100

95-
### Toggle Header / Code File
101+
## Toggle Header / Code File
96102

97103
Right-click and choose **Toggle Header / Code File** to switch back and forth between a header file and its associated code file.
98104

99-
### Outlining
105+
## Outlining
100106

101107
Right-click anywhere in a source code file and choose **Outlining** to collapse or expand definitions and/or custom regions to make it easier to browse only the parts you are interested in. For more information, see [Outlining](/visualstudio/ide/outlining).
102108

103109
![Visual C++ Outlining](../ide/media/vs2015_cpp_outlining.png "vs2015_cpp_outlining")
104110

105-
### Scroll bar map mode
111+
## Scrollbar map mode
106112

107-
Scrollbar map mode enables you to quickly scroll and browse through a code file without actually leaving your current location. Or click anywhere on the code map to go directly to that location.
113+
Scrollbar map mode enables you to quickly scroll and browse through a code file without actually leaving your current location. Or click anywhere on the code map to go directly to that location. For more information, see [How to: Track your code by customizing the scrollbar](/visualstudio/ide/how-to-track-your-code-by-customizing-the-scrollbar).
108114

109115
![Code Map in Visual C++](../ide/media/vs2015_cpp_code_map.png "vs2015_cpp_code_map")
110116

111-
### Generate graph of include files
117+
## Generate graph of include files
112118

113119
Right click on a code file in your project and choose **Generate graph of include files** to see a graph of which files are included by other files.
114120

115121
![Visual C++ graph of include files](../ide/media/vs2015_cpp_include_graph.png "vs2015_cpp_include_graph")
116122

117-
### F1 Help
123+
## F1 Help
118124

119-
Place the cursor on or just after any type, keyword or function and press F1 to go directly to the relevant MSDN reference topic. F1 also works on items in the error list, and in many dialog boxes.
125+
Place the cursor on or just after any type, keyword or function and press F1 to go directly to the relevant reference topic on docs.microsoft.com. F1 also works on items in the error list, and in many dialog boxes.
120126

121-
### Quick Launch
127+
## Quick Launch
122128

123129
To easily navigate to any window or tool in Visual Studio, simply type its name in the Quick Launch window in the upper right corner of the UI. The auto-completion list will filter as you type.
124130

0 commit comments

Comments
 (0)