Skip to content

Commit f7543e3

Browse files
authored
Add Getting Started Walkthrough (#7512)
1 parent 7a2de29 commit f7543e3

32 files changed

+348
-32
lines changed

Extension/package.json

+152-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,157 @@
4949
],
5050
"main": "./dist/main",
5151
"contributes": {
52+
"walkthroughs": [
53+
{
54+
"id": "cppWelcome",
55+
"title": "Get Started with C++ Development",
56+
"description": "Dive into VS Code's rich C++ development experience.",
57+
"steps": [
58+
{
59+
"id": "verify.compiler.mac",
60+
"title": "Install a C++ compiler",
61+
"description": "The C++ extension uses the C++ compiler on your system to configure IntelliSense for your project. \n[Check for C++ compilers](command:C_Cpp.CheckForCompiler)",
62+
"when": "isMac",
63+
"media": {
64+
"altText": "A markdown file with instructions for installing Clang on macOS.",
65+
"path": "walkthrough/installcompiler/install-clang-macos.md"
66+
}
67+
},
68+
{
69+
"id": "verify.compiler.linux",
70+
"title": "Install a C++ compiler",
71+
"description": "The C++ extension uses the C++ compiler on your system to configure IntelliSense for your project. \n[Check for C++ compilers](command:C_Cpp.CheckForCompiler)",
72+
"when": "isLinux",
73+
"media": {
74+
"altText": "A markdown file with instructions for installing GCC on Linux.",
75+
"path": "walkthrough/installcompiler/install-gcc-linux.md"
76+
}
77+
},
78+
{
79+
"id": "verify.compiler.windows",
80+
"title": "Install a C++ compiler",
81+
"description": "The C++ extension uses the C++ compiler on your system to configure IntelliSense for your project. \n[Check for C++ compilers](command:C_Cpp.CheckForCompiler)",
82+
"when": "isWindows",
83+
"media": {
84+
"altText": "A markdown file with instructions for installing MSVC on Windows.",
85+
"path": "walkthrough/installcompiler/install-compiler-windows.md"
86+
}
87+
},
88+
{
89+
"id": "open.project",
90+
"title": "Open your project folder",
91+
"description": "Open an existing folder that contains your C++ project, or create a new folder. \n[Pick a folder](command:workbench.action.files.openFolder)",
92+
"when": "workspaceFolderCount == 0",
93+
"media": {
94+
"altText": "A screenshot that shows a C++ project opened in the file Explorer.",
95+
"path": {
96+
"light": "walkthrough/images/cpp-folder-explorer-light.png",
97+
"dark": "walkthrough/images/cpp-folder-explorer-dark.png",
98+
"hc": "walkthrough/images/cpp-folder-explorer-hc.png"
99+
}
100+
}
101+
},
102+
{
103+
"id": "setup.intellisense",
104+
"title": "Configure C++ IntelliSense",
105+
"description": "Verify important IntelliSense settings like Compiler Path, Compiler Args, IntelliSense Mode, and Include Path. \n[Open IntelliSense Configuration](command:C_Cpp.ConfigurationEditUI?-2)",
106+
"media": {
107+
"altText": "A screenshot that shows the IntelliSense Configurations UI with important settings highlighted.",
108+
"path": {
109+
"light": "walkthrough/images/intellisense-config-light.png",
110+
"dark": "walkthrough/images/intellisense-config-dark.png",
111+
"hc": "walkthrough/images/intellisense-config-hc.png"
112+
}
113+
}
114+
},
115+
{
116+
"id": "build.project.mac",
117+
"title": "Build your C++ file",
118+
"description": "Create a default build task for your project. \n[Learn more](https://code.visualstudio.com/docs/cpp/config-clang-mac#_build-helloworldcpp)",
119+
"when": "isMac",
120+
"media": {
121+
"altText": "A markdown file with instructions for configuring the default build task on macOS with Clang.",
122+
"path": "walkthrough/buildtask/build-project-mac.md"
123+
}
124+
},
125+
{
126+
"id": "build.project.linux",
127+
"title": "Build your C++ file",
128+
"description": "Create a default build task for your project. \n[Learn more](https://code.visualstudio.com/docs/cpp/config-linux#_build-helloworldcpp)",
129+
"when": "isLinux",
130+
"media": {
131+
"altText": "A markdown file with instructions for configuring the default build task on Linux with GCC.",
132+
"path": "walkthrough/buildtask/build-project-linux.md"
133+
}
134+
},
135+
{
136+
"id": "build.project.windows",
137+
"title": "Build your C++ file",
138+
"description": "Create a default build task for your project. \n[Learn more](https://code.visualstudio.com/docs/cpp/config-msvc#_build-helloworldcpp)",
139+
"when": "isWindows",
140+
"media": {
141+
"altText": "A markdown file with instructions for configuring the default build task on Windows with MSVC.",
142+
"path": "walkthrough/buildtask/build-project-windows.md"
143+
}
144+
},
145+
{
146+
"id": "run.project.mac",
147+
"title": "Run and debug your C++ file",
148+
"description": "Create a debug configuration for your project. \n[Learn more](https://code.visualstudio.com/docs/cpp/config-clang-mac#_debug-helloworldcpp)",
149+
"when": "isMac",
150+
"media": {
151+
"altText": "A markdown file with instructions for starting a debugging session on macOS.",
152+
"path": "walkthrough/debugconfig/run-and-debug-project-mac.md"
153+
}
154+
},
155+
{
156+
"id": "run.project.linux",
157+
"title": "Run and debug your C++ file",
158+
"description": "Create a debug configuration for your project. \n[Learn more](https://code.visualstudio.com/docs/cpp/config-linux#_debug-helloworldcpp)",
159+
"when": "isLinux",
160+
"media": {
161+
"altText": "A markdown file with instructions for starting a debugging session on Linux.",
162+
"path": "walkthrough/debugconfig/run-and-debug-project-linux.md"
163+
}
164+
},
165+
{
166+
"id": "run.project.windows",
167+
"title": "Run and debug your C++ file",
168+
"description": "Create a debug configuration for your project. \n[Learn more](https://code.visualstudio.com/docs/cpp/config-msvc#_debug-helloworldcpp)",
169+
"when": "isWindows",
170+
"media": {
171+
"altText": "A markdown file with instructions for starting a debugging session on Windows.",
172+
"path": "walkthrough/debugconfig/run-and-debug-project-windows.md"
173+
}
174+
},
175+
{
176+
"id": "install.cmake.tools",
177+
"title": "Install CMake Tools",
178+
"description": "Do you build your project with CMake? Install the CMake Tools extension to seamlessly build and debug your CMake project. \n[Install CMake Tools](command:workbench.extensions.installExtension?%22ms-vscode.cmake-tools%22)",
179+
"completionEvents": [
180+
"extensionInstalled:ms-vscode.cmake-tools"
181+
],
182+
"media": {
183+
"altText": "A screenshot of the CMake Tools extension page in the Marketplace.",
184+
"path": {
185+
"light": "walkthrough/images/cmake-tools-light.png",
186+
"dark": "walkthrough/images/cmake-tools-dark.png",
187+
"hc": "walkthrough/images/cmake-tools-hc.png"
188+
}
189+
}
190+
},
191+
{
192+
"id": "watch.tutorials",
193+
"title": "Lean back and get started",
194+
"description": "Watch this series of short and practical videos about setting up C++ IntelliSense and building and debugging C++ projects. \n[Watch Tutorials](https://code.visualstudio.com/docs/cpp/introvideos-cpp)",
195+
"media": {
196+
"altText": "A screenshot with a preview of the video tutorial and a play button.",
197+
"path": "walkthrough/images/getting-started-video.png"
198+
}
199+
}
200+
]
201+
}
202+
],
52203
"taskDefinitions": [
53204
{
54205
"type": "cppbuild",
@@ -2847,4 +2998,4 @@
28472998
"integrity": "E5046509D510086B99F171595114220AD8E9F820E7238B6A5199CD78B9AD2078"
28482999
}
28493000
]
2850-
}
3001+
}

Extension/src/LanguageServer/client.ts

+39-12
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,12 @@ export interface Client {
596596
handleConfigurationProviderSelectCommand(): Promise<void>;
597597
handleShowParsingCommands(): Promise<void>;
598598
handleReferencesIcon(): void;
599-
handleConfigurationEditCommand(): void;
600-
handleConfigurationEditJSONCommand(): void;
601-
handleConfigurationEditUICommand(): void;
599+
handleConfigurationEditCommand(viewColumn?: vscode.ViewColumn): void;
600+
handleConfigurationEditJSONCommand(viewColumn?: vscode.ViewColumn): void;
601+
handleConfigurationEditUICommand(viewColumn?: vscode.ViewColumn): void;
602602
handleAddToIncludePathCommand(path: string): void;
603603
handleGoToDirectiveInGroup(next: boolean): Promise<void>;
604+
handleCheckForCompiler(): Promise<void>;
604605
onInterval(): void;
605606
dispose(): void;
606607
addFileAssociations(fileAssociations: string, languageId: string): void;
@@ -2620,16 +2621,16 @@ export class DefaultClient implements Client {
26202621
}
26212622
}
26222623

2623-
public handleConfigurationEditCommand(): void {
2624-
this.notifyWhenLanguageClientReady(() => this.configuration.handleConfigurationEditCommand(undefined, vscode.window.showTextDocument));
2624+
public handleConfigurationEditCommand(viewColumn: vscode.ViewColumn = vscode.ViewColumn.Active): void {
2625+
this.notifyWhenLanguageClientReady(() => this.configuration.handleConfigurationEditCommand(undefined, vscode.window.showTextDocument, viewColumn));
26252626
}
26262627

2627-
public handleConfigurationEditJSONCommand(): void {
2628-
this.notifyWhenLanguageClientReady(() => this.configuration.handleConfigurationEditJSONCommand(undefined, vscode.window.showTextDocument));
2628+
public handleConfigurationEditJSONCommand(viewColumn: vscode.ViewColumn = vscode.ViewColumn.Active): void {
2629+
this.notifyWhenLanguageClientReady(() => this.configuration.handleConfigurationEditJSONCommand(undefined, vscode.window.showTextDocument, viewColumn));
26292630
}
26302631

2631-
public handleConfigurationEditUICommand(): void {
2632-
this.notifyWhenLanguageClientReady(() => this.configuration.handleConfigurationEditUICommand(undefined, vscode.window.showTextDocument));
2632+
public handleConfigurationEditUICommand(viewColumn: vscode.ViewColumn = vscode.ViewColumn.Active): void {
2633+
this.notifyWhenLanguageClientReady(() => this.configuration.handleConfigurationEditUICommand(undefined, vscode.window.showTextDocument, viewColumn));
26332634
}
26342635

26352636
public handleAddToIncludePathCommand(path: string): void {
@@ -2660,6 +2661,31 @@ export class DefaultClient implements Client {
26602661
}
26612662
}
26622663

2664+
public async handleCheckForCompiler(): Promise<void> {
2665+
await this.awaitUntilLanguageClientReady();
2666+
const compilers: configs.KnownCompiler[] | undefined = await this.getKnownCompilers();
2667+
if (!compilers || compilers.length === 0) {
2668+
const compilerName: string = process.platform === "win32" ? "MSVC" : (process.platform === "darwin" ? "Clang" : "GCC");
2669+
vscode.window.showInformationMessage(localize("no.compilers.found", "No C++ compilers were found on your system. For your platform, we recommend installing {0} using the instructions in the editor.", compilerName), { modal: true });
2670+
} else {
2671+
const header: string = localize("compilers.found", "We found the following C++ compiler(s) on your system:");
2672+
let message: string = header + "\n";
2673+
const settings: CppSettings = new CppSettings(this.RootUri);
2674+
const pathSeparator: string | undefined = settings.preferredPathSeparator;
2675+
compilers.forEach(compiler => {
2676+
if (pathSeparator !== "Forward Slash") {
2677+
message += "\n" + compiler.path.replace(/\//g, '\\');
2678+
} else {
2679+
message += "\n" + compiler.path.replace(/\\/g, '/');
2680+
}
2681+
});
2682+
if (compilers.length > 1) {
2683+
message += "\n\n" + localize("compilers.found.message", "You can specify which compiler to use in your project's IntelliSense Configuration.");
2684+
}
2685+
vscode.window.showInformationMessage(message, { modal: true });
2686+
}
2687+
}
2688+
26632689
public onInterval(): void {
26642690
// These events can be discarded until the language client is ready.
26652691
// Don't queue them up with this.notifyWhenLanguageClientReady calls.
@@ -2823,11 +2849,12 @@ class NullClient implements Client {
28232849
handleConfigurationProviderSelectCommand(): Promise<void> { return Promise.resolve(); }
28242850
handleShowParsingCommands(): Promise<void> { return Promise.resolve(); }
28252851
handleReferencesIcon(): void {}
2826-
handleConfigurationEditCommand(): void {}
2827-
handleConfigurationEditJSONCommand(): void {}
2828-
handleConfigurationEditUICommand(): void {}
2852+
handleConfigurationEditCommand(viewColumn?: vscode.ViewColumn): void {}
2853+
handleConfigurationEditJSONCommand(viewColumn?: vscode.ViewColumn): void {}
2854+
handleConfigurationEditUICommand(viewColumn?: vscode.ViewColumn): void {}
28292855
handleAddToIncludePathCommand(path: string): void { }
28302856
handleGoToDirectiveInGroup(next: boolean): Promise<void> { return Promise.resolve(); }
2857+
handleCheckForCompiler(): Promise<void> { return Promise.resolve(); }
28312858
onInterval(): void {}
28322859
dispose(): void {
28332860
this.booleanEvent.dispose();

Extension/src/LanguageServer/configurations.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -914,17 +914,17 @@ export class CppProperties {
914914
}
915915

916916
// onBeforeOpen will be called after c_cpp_properties.json have been created (if it did not exist), but before the document is opened.
917-
public handleConfigurationEditCommand(onBeforeOpen: (() => void) | undefined, showDocument: (document: vscode.TextDocument) => void): void {
917+
public handleConfigurationEditCommand(onBeforeOpen: (() => void) | undefined, showDocument: (document: vscode.TextDocument, column?: vscode.ViewColumn) => void, viewColumn?: vscode.ViewColumn): void {
918918
const otherSettings: OtherSettings = new OtherSettings(this.rootUri);
919919
if (otherSettings.settingsEditor === "ui") {
920-
this.handleConfigurationEditUICommand(onBeforeOpen, showDocument);
920+
this.handleConfigurationEditUICommand(onBeforeOpen, showDocument, viewColumn);
921921
} else {
922-
this.handleConfigurationEditJSONCommand(onBeforeOpen, showDocument);
922+
this.handleConfigurationEditJSONCommand(onBeforeOpen, showDocument, viewColumn);
923923
}
924924
}
925925

926926
// onBeforeOpen will be called after c_cpp_properties.json have been created (if it did not exist), but before the document is opened.
927-
public async handleConfigurationEditJSONCommand(onBeforeOpen: (() => void) | undefined, showDocument: (document: vscode.TextDocument) => void): Promise<void> {
927+
public async handleConfigurationEditJSONCommand(onBeforeOpen: (() => void) | undefined, showDocument: (document: vscode.TextDocument, column?: vscode.ViewColumn) => void, viewColumn?: vscode.ViewColumn): Promise<void> {
928928
await this.ensurePropertiesFile();
929929
console.assert(this.propertiesFile);
930930
if (onBeforeOpen) {
@@ -934,7 +934,7 @@ export class CppProperties {
934934
if (this.propertiesFile) {
935935
const document: vscode.TextDocument = await vscode.workspace.openTextDocument(this.propertiesFile);
936936
if (showDocument) {
937-
showDocument(document);
937+
showDocument(document, viewColumn);
938938
}
939939
}
940940
}
@@ -953,7 +953,7 @@ export class CppProperties {
953953
}
954954

955955
// onBeforeOpen will be called after c_cpp_properties.json have been created (if it did not exist), but before the document is opened.
956-
public async handleConfigurationEditUICommand(onBeforeOpen: (() => void) | undefined, showDocument: (document: vscode.TextDocument) => void): Promise<void> {
956+
public async handleConfigurationEditUICommand(onBeforeOpen: (() => void) | undefined, showDocument: (document: vscode.TextDocument, column?: vscode.ViewColumn) => void, viewColumn?: vscode.ViewColumn): Promise<void> {
957957
await this.ensurePropertiesFile();
958958
if (this.propertiesFile) {
959959
if (onBeforeOpen) {
@@ -968,14 +968,15 @@ export class CppProperties {
968968
this.settingsPanel.selectedConfigIndex = this.CurrentConfigurationIndex;
969969
this.settingsPanel.createOrShow(configNames,
970970
this.configurationJson.configurations[this.settingsPanel.selectedConfigIndex],
971-
this.getErrorsForConfigUI(this.settingsPanel.selectedConfigIndex));
971+
this.getErrorsForConfigUI(this.settingsPanel.selectedConfigIndex),
972+
viewColumn);
972973
}
973974
}
974975
} else {
975976
// Parse failed, open json file
976977
const document: vscode.TextDocument = await vscode.workspace.openTextDocument(this.propertiesFile);
977978
if (showDocument) {
978-
showDocument(document);
979+
showDocument(document, viewColumn);
979980
}
980981
}
981982
}

0 commit comments

Comments
 (0)