Skip to content

Commit a7cefc9

Browse files
author
Tara Raj
authored
Merge branch 'master' into taraj/box-sample
2 parents 148ae1d + 30d8a1d commit a7cefc9

File tree

10 files changed

+76
-64
lines changed

10 files changed

+76
-64
lines changed

Documentation/LanguageServer/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you want IntelliSense to operate on your files even when all #include directi
3131
The most common reason for this is missing include paths and defines. The easiest way to fix this on each platform is as follows:
3232

3333
**Linux/Mac**
34-
* Set `"intelliSenseMode": "clang-x64"` and `"compilerPath"` in **c_cpp_properties.json** to the path to your compiler.
34+
* Set `"intelliSenseMode": "clang-x64"` or `"intelliSenseMode": "gcc-x64"` and `"compilerPath"` in **c_cpp_properties.json** to the path to your compiler.
3535

3636
**Windows**
3737
* If you are using a Microsoft compiler from Visual Studio, set `"intelliSenseMode": "msvc-x64"`, but don't add the `"compilerPath"` property to **c_cpp_properties.json**.

Extension/CHANGELOG.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,44 @@
11
# C/C++ for Visual Studio Code Change Log
22

3-
## Version 0.22.0-insiders3: March 14, 2019
4-
* Fix bugs with squiggles and IntelliSense updating after edits. [#1779](https://github.com/Microsoft/vscode-cpptools/issues/1779), [#3124](https://github.com/Microsoft/vscode-cpptools/issues/3124), [#3260](https://github.com/Microsoft/vscode-cpptools/issues/3260)
5-
* Fix formatting (and other non-IntelliSense operations) being blocked by IntelliSense processing. [#1928](https://github.com/Microsoft/vscode-cpptools/issues/1928)
6-
* Show a prompt for changing `C_Cpp.updateChannel` to `Insiders`. [#3089](https://github.com/Microsoft/vscode-cpptools/issues/3089)
7-
* lh123 (@lh123) [PR #3221](https://github.com/Microsoft/vscode-cpptools/pull/3221)
8-
* Fix bugs with the Insider reload prompt appearing when it shouldn't. [#3206](https://github.com/Microsoft/vscode-cpptools/issues/3206)
9-
* Enable `F5` and the `Build and Debug Active File` context menu command. [PR #3244](https://github.com/Microsoft/vscode-cpptools/pull/3244)
10-
* Fix IntelliSense process crashing with Mac Sierra 10.12 or earlier. [#3256](https://github.com/Microsoft/vscode-cpptools/issues/3256)
11-
* Fix incorrect `c_cpp_properties.json` squiggles with `cl.exe`. [#3263](https://github.com/Microsoft/vscode-cpptools/pull/3263)
12-
* Add `cl.exe` build and debug support. [PR #3264](https://github.com/Microsoft/vscode-cpptools/pull/3264)
13-
* Fix debugging not working for Windows 32-bit programs. [#3258](https://github.com/Microsoft/vscode-cpptools/issues/3258)
14-
* Add warning squiggles for invalid properties in `c_cpp_properties.json`. [PR #3283](https://github.com/Microsoft/vscode-cpptools/pull/3283)
15-
* Fix AutoPCH performance on Windows and Linux.
16-
17-
## Version 0.22.0-insiders2: March 1, 2019
3+
## Version 0.22.1: March 21, 2019
4+
* Fix `tasks.json` with single-line comments being overwritten when `Build and Debug Active File` is used. [#3327](https://github.com/Microsoft/vscode-cpptools/issues/3327)
5+
* Fix an invalid `compilerPath` property getting added to `tasks.json` after doing `Configure Task` with a C/C++ compiler.
6+
* Add IntelliSense caching for macOS 10.13 or later (0.22.0 only supported Windows and Linux).
7+
8+
## Version 0.22.0: March 19, 2019
9+
### Major Changes
10+
* Add warning squiggles for invalid properties and paths in `c_cpp_properties.json`. [#2799](https://github.com/Microsoft/vscode-cpptools/issues/2799), [PR #3283](https://github.com/Microsoft/vscode-cpptools/pull/3283)
11+
* Add C/C++ compiler build tasks for compiling the active source file, with support for `F5` debugging and the `Build and Debug Active File` context menu command. [PR #3118](https://github.com/Microsoft/vscode-cpptools/pull/3118), [PR #3244](https://github.com/Microsoft/vscode-cpptools/pull/3244)
12+
* Add AutoPCH support to reduce IntelliSense parsing time, with `C_Cpp.intelliSenseCachePath` and `C_Cpp.intelliSenseCacheSize` settings. It isn't enabled for Mac yet. [PR #3184](https://github.com/Microsoft/vscode-cpptools/pull/3184)
13+
14+
### Minor Changes
1815
* Fix IntelliSense not working on Windows when the username has a space in it and file `C:\Users\<firstname>` exists. [#1377](https://github.com/Microsoft/vscode-cpptools/issues/1377), [#2114](https://github.com/Microsoft/vscode-cpptools/issues/2114), [#2176](https://github.com/Microsoft/vscode-cpptools/issues/2176), [#3052](https://github.com/Microsoft/vscode-cpptools/issues/3052), [#3139](https://github.com/Microsoft/vscode-cpptools/issues/3139)
1916
* Enable `${command:cpptools.activeConfigName}` in tasks. [#1524](https://github.com/Microsoft/vscode-cpptools/issues/1524)
17+
* Fix bugs with squiggles and IntelliSense updating after edits. [#1779](https://github.com/Microsoft/vscode-cpptools/issues/1779), [#3124](https://github.com/Microsoft/vscode-cpptools/issues/3124), [#3260](https://github.com/Microsoft/vscode-cpptools/issues/3260)
18+
* Fix formatting (and other non-IntelliSense operations) being blocked by IntelliSense processing. [#1928](https://github.com/Microsoft/vscode-cpptools/issues/1928)
2019
* Fix completion when the start of an identifier matches a keyword. [#1986](https://github.com/Microsoft/vscode-cpptools/issues/1986)
2120
* Fix auto-removal of compiler-provided paths in `includePath`. [#2177](https://github.com/Microsoft/vscode-cpptools/issues/2177)
22-
* Add support for `Scope::Member` scoped symbol searches. [#2484](https://github.com/Microsoft/vscode-cpptools/issues/2484)
23-
* Fix remote process picker bug. [#2585](https://github.com/Microsoft/vscode-cpptools/issues/2585), [#3150](https://github.com/Microsoft/vscode-cpptools/issues/3150)
24-
* Add warning squiggles for invalid paths in `c_cpp_properties.json`. [#2799](https://github.com/Microsoft/vscode-cpptools/issues/2799)
25-
* Fix bug with manual completion invocation after `struct`. [#3080](https://github.com/Microsoft/vscode-cpptools/issues/3080)
26-
* Add C/C++ compiler build tasks for compiling the active source file. [PR #3118](https://github.com/Microsoft/vscode-cpptools/pull/3118)
27-
* Fix command not found and empty `c_cpp_properties.json` if activation is too slow. [#3160](https://github.com/Microsoft/vscode-cpptools/issues/3160), [#3176](https://github.com/Microsoft/vscode-cpptools/issues/3176)
28-
* Add AutoPCH support to reduce IntelliSense parsing time, with `C_Cpp.intelliSenseCachePath` and `C_Cpp.intelliSenseCacheSize` settings. [PR #3184](https://github.com/Microsoft/vscode-cpptools/pull/3184)
29-
* Fix `cppvsdbg` debugger showing `"An unspecified error has occurred."` for structured binding variables. [#3197](https://github.com/Microsoft/vscode-cpptools/issues/3197)
30-
31-
## Version 0.22.0-insiders: February 6, 2019
3221
* Fix crash on Windows when 8.3 filenames are used. [#2453](https://github.com/Microsoft/vscode-cpptools/issues/2453), [#3104](https://github.com/Microsoft/vscode-cpptools/issues/3104)
22+
* Add support for `Scope::Member` scoped symbol searches. [#2484](https://github.com/Microsoft/vscode-cpptools/issues/2484)
3323
* Fix signature help active parameter selection when parameter names are missing or subsets of each other. [#2952](https://github.com/Microsoft/vscode-cpptools/issues/2952)
3424
* Fix `--enable-pretty-printing` with `gdb` when complex objects are used as keys in maps. [#3024](https://github.com/Microsoft/vscode-cpptools/issues/3024)
3525
* Fix IntelliSense-based `Go to Definition` for `noexcept` methods. [#3060](https://github.com/Microsoft/vscode-cpptools/issues/3060)
3626
* Render macro hover expansions as C/C++. [#3075](https://github.com/Microsoft/vscode-cpptools/issues/3075)
3727
* Enable completion after `struct` when manually invoked. [#3080](https://github.com/Microsoft/vscode-cpptools/issues/3080)
3828
* Add `C_Cpp.suggestSnippets` setting to disable language server snippets. [#3083](https://github.com/Microsoft/vscode-cpptools/issues/3083)
29+
* Show a prompt for changing `C_Cpp.updateChannel` to `Insiders`. [#3089](https://github.com/Microsoft/vscode-cpptools/issues/3089)
30+
* lh123 (@lh123) [PR #3221](https://github.com/Microsoft/vscode-cpptools/pull/3221)
3931
* Fix `compilerPath` not getting priority over the `compile_commands.json` compiler. [#3102](https://github.com/Microsoft/vscode-cpptools/issues/3102)
4032
* Fix Linux `compile_commands.json` compiler querying with relative paths. [#3112](https://github.com/Microsoft/vscode-cpptools/issues/3112)
4133
* Allow `*` in `includePath` to apply to `browse.path` when `browse.path` is not specified. [#3121](https://github.com/Microsoft/vscode-cpptools/issues/3121)
4234
* Tucker Kern (@mill1000) [PR #3122](https://github.com/Microsoft/vscode-cpptools/pull/3122)
4335
* Disable `(` and `<` completion commit characters. [#3127](https://github.com/Microsoft/vscode-cpptools/issues/3127)
4436
* Add Chinese translations for command titles. [PR #3128](https://github.com/Microsoft/vscode-cpptools/pull/3128)
37+
* Fix remote process picker bug. [#2585](https://github.com/Microsoft/vscode-cpptools/issues/2585), [#3150](https://github.com/Microsoft/vscode-cpptools/issues/3150)
38+
* Fix command not found and empty `c_cpp_properties.json` if activation is too slow. [#3160](https://github.com/Microsoft/vscode-cpptools/issues/3160), [#3176](https://github.com/Microsoft/vscode-cpptools/issues/3176)
39+
* Fix `cppvsdbg` debugger showing `"An unspecified error has occurred."` for structured binding variables. [#3197](https://github.com/Microsoft/vscode-cpptools/issues/3197)
40+
* Fix bugs with the Insider reload prompt appearing when it shouldn't. [#3206](https://github.com/Microsoft/vscode-cpptools/issues/3206)
41+
* Fix variable expansion (e.g. `${env.HOME}`) not working when `${default}` is used in `c_cpp_properties.json`. [#3309](https://github.com/Microsoft/vscode-cpptools/issues/3309)
4542
* Fix other unreported IntelliSense engine bugs.
4643

4744
## Version 0.21.0: January 23, 2019

Extension/ReleaseNotes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ <h1>Microsoft C/C++ Extension for VS Code</h1>
208208
<h2 class="caption">March 2019 Update</h2>
209209
<div>Thank you for installing the C/C++ extension! We're excited to announce the following features in the March update:<br/>
210210
<h3 style="font-weight: 600">IntelliSense caching</h3>
211-
On Windows and Linux, the extension will now cache header information to improve IntelliSense speed for your code files. Support for macOS will be available in a future release.<br/>
211+
The extension will now cache header information to improve IntelliSense speed for your code files.<br/>
212212
<br/>
213213
<em style="font-weight: 600">Please Note:</em> The extension writes the cache to disk in order to achieve this performance improvement. By default the cache files will be stored in your workspace
214214
folder's ".vscode" folder, but you can change this location by using the <code>"C_Cpp.intelliSenseCachePath"</code> setting. You can also control how much disk space can be

Extension/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cpptools",
33
"displayName": "C/C++",
44
"description": "C/C++ IntelliSense, debugging, and code browsing.",
5-
"version": "0.22.0-master",
5+
"version": "0.22.1-master",
66
"publisher": "ms-vscode",
77
"preview": true,
88
"icon": "LanguageCCPP_color_128x.png",
@@ -1451,7 +1451,7 @@
14511451
"runtimeDependencies": [
14521452
{
14531453
"description": "C/C++ language components (Linux / x86_64)",
1454-
"url": "https://go.microsoft.com/fwlink/?linkid=2065016",
1454+
"url": "https://go.microsoft.com/fwlink/?linkid=2084924",
14551455
"platforms": [
14561456
"linux"
14571457
],
@@ -1465,7 +1465,7 @@
14651465
},
14661466
{
14671467
"description": "C/C++ language components (Linux / x86)",
1468-
"url": "https://go.microsoft.com/fwlink/?linkid=2065017",
1468+
"url": "https://go.microsoft.com/fwlink/?linkid=2085028",
14691469
"platforms": [
14701470
"linux"
14711471
],
@@ -1481,7 +1481,7 @@
14811481
},
14821482
{
14831483
"description": "C/C++ language components (OS X)",
1484-
"url": "https://go.microsoft.com/fwlink/?linkid=2064955",
1484+
"url": "https://go.microsoft.com/fwlink/?linkid=2084925",
14851485
"platforms": [
14861486
"darwin"
14871487
],
@@ -1492,7 +1492,7 @@
14921492
},
14931493
{
14941494
"description": "C/C++ language components (Windows)",
1495-
"url": "https://go.microsoft.com/fwlink/?linkid=2065027",
1495+
"url": "https://go.microsoft.com/fwlink/?linkid=2085027",
14961496
"platforms": [
14971497
"win32"
14981498
],

Extension/src/Debugger/configurationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
9494
* Returns a list of initial debug configurations based on contextual information, e.g. package.json or folder.
9595
*/
9696
async provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken): Promise<vscode.DebugConfiguration[]> {
97-
let buildTasks: vscode.Task[] = await getBuildTasks();
97+
let buildTasks: vscode.Task[] = await getBuildTasks(true);
9898
if (buildTasks.length === 0) {
9999
return Promise.resolve(this.provider.getInitialConfigurations(this.type));
100100
}

Extension/src/Debugger/extension.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ export function initialize(context: vscode.ExtensionContext): void {
9191
await util.ensureBuildTaskExists(selection.configuration.preLaunchTask);
9292
Telemetry.logDebuggerEvent("buildAndDebug", { "success": "false" });
9393
} catch (e) {
94+
if (e && e.message === util.failedToParseTasksJson) {
95+
vscode.window.showErrorMessage(util.failedToParseTasksJson);
96+
}
9497
return Promise.resolve();
9598
}
9699
} else {
97100
return Promise.resolve();
98101
// TODO uncomment this when single file mode works correctly.
99-
// const buildTasks: vscode.Task[] = await getBuildTasks();
102+
// const buildTasks: vscode.Task[] = await getBuildTasks(true);
100103
// const task: vscode.Task = buildTasks.find(task => task.name === selection.configuration.preLaunchTask);
101104
// await vscode.tasks.executeTask(task);
102105
// delete selection.configuration.preLaunchTask;

Extension/src/LanguageServer/client.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,11 @@ class DefaultClient implements Client {
383383

384384
let intelliSenseCacheDisabled: boolean = false;
385385
if (os.platform() === "darwin") {
386-
intelliSenseCacheDisabled = true;
387-
// TODO: Re-enable this after the performance is improved on Mac.
388-
//const releaseParts: string[] = os.release().split(".");
389-
//if (releaseParts.length >= 1) {
390-
// // AutoPCH doesn't work for older Mac OS's.
391-
// intelliSenseCacheDisabled = parseInt(releaseParts[0]) < 17;
392-
//}
386+
const releaseParts: string[] = os.release().split(".");
387+
if (releaseParts.length >= 1) {
388+
// AutoPCH doesn't work for older Mac OS's.
389+
intelliSenseCacheDisabled = parseInt(releaseParts[0]) < 17;
390+
}
393391
}
394392

395393
let clientOptions: LanguageClientOptions = {

Extension/src/LanguageServer/configurations.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -753,15 +753,9 @@ export class CppProperties {
753753
paths.add(`"${this.CurrentConfiguration.compileCommands}"`);
754754
}
755755

756-
const isWindows: boolean = os.platform() === 'win32';
757756
if (this.CurrentConfiguration.compilerPath) {
758-
let compilerPathAndArgs: util.CompilerPathAndArgs;
759-
compilerPathAndArgs = util.extractCompilerPathAndArgs(this.CurrentConfiguration.compilerPath);
760-
if (!(isWindows && compilerPathAndArgs.compilerPath.endsWith("cl.exe"))) {
761-
// Unlike other cases, compilerPath may not start or end with " due to trimming of whitespace.
762-
// This is checked to determine if the path is a compilerPath later on.
763-
paths.add(`${compilerPathAndArgs.compilerPath}`);
764-
}
757+
// Unlike other cases, compilerPath may not start or end with " due to trimming of whitespace and the possibility of compiler args.
758+
paths.add(`${this.CurrentConfiguration.compilerPath}`);
765759
}
766760

767761
// Get the start/end for properties that are file-only.
@@ -776,10 +770,11 @@ export class CppProperties {
776770
this.prevSquiggleMetrics[this.CurrentConfiguration.name] = { PathNonExistent: 0, PathNotAFile: 0, PathNotADirectory: 0 };
777771
}
778772
let newSquiggleMetrics: { [key: string]: number } = { PathNonExistent: 0, PathNotAFile: 0, PathNotADirectory: 0 };
773+
const isWindows: boolean = os.platform() === 'win32';
779774

780775
for (let curPath of paths) {
781-
const isCompilerPath: boolean = !curPath.startsWith('"'); // This check probably will need to change later.
782-
let resolvedPath: string = curPath.substr((!isCompilerPath ? 1 : 0), curPath.length + (!isCompilerPath ? - 2 : 0));
776+
const isCompilerPath: boolean = curPath === this.CurrentConfiguration.compilerPath;
777+
let resolvedPath: string = isCompilerPath ? curPath : curPath.substr(1, curPath.length - 2); // Remove the surrounding quotes.
783778
// Resolve special path cases.
784779
if (resolvedPath === "${default}") {
785780
// TODO: Add squiggles for when the C_Cpp.default.* paths are invalid.
@@ -799,6 +794,8 @@ export class CppProperties {
799794
resolvedPath = resolvedPath.replace(/\*/g, "");
800795
}
801796

797+
// TODO: Invalid paths created from environment variables are not detected.
798+
802799
// Handle WSL paths.
803800
const isWSL: boolean = isWindows && resolvedPath.startsWith("/");
804801
if (isWSL) {
@@ -808,11 +805,19 @@ export class CppProperties {
808805
resolvedPath = resolvedPath.substr(0, 1) + ":" + resolvedPath.substr(1);
809806
} else if (this.rootfs && this.rootfs.length > 0) {
810807
resolvedPath = this.rootfs + resolvedPath.substr(1);
811-
resolvedPath = resolvedPath.replace(/\//g, path.sep);
812808
// TODO: Handle WSL symlinks.
813809
}
814810
}
815811

812+
if (isCompilerPath) {
813+
let compilerPathAndArgs: util.CompilerPathAndArgs = util.extractCompilerPathAndArgs(resolvedPath);
814+
if (isWindows && compilerPathAndArgs.compilerPath.endsWith("cl.exe")) {
815+
continue; // Don't squiggle invalid cl.exe paths because it could be for an older preview build.
816+
}
817+
resolvedPath = compilerPathAndArgs.compilerPath;
818+
curPath = curPath.replace(/\"/g, `\\"`);
819+
}
820+
816821
let pathExists: boolean = true;
817822
let existsWithExeAdded: (path: string) => boolean = (path: string) => {
818823
return isCompilerPath && isWindows && !isWSL && fs.existsSync(path + ".exe");
@@ -835,6 +840,13 @@ export class CppProperties {
835840
}
836841
}
837842

843+
// Normalize path separators.
844+
if (path.sep === "/") {
845+
resolvedPath = resolvedPath.replace(/\\/g, path.sep);
846+
} else {
847+
resolvedPath = resolvedPath.replace(/\//g, path.sep);
848+
}
849+
838850
// Iterate through the text and apply squiggles.
839851
for (let curOffset: number = curText.indexOf(curPath); curOffset !== -1; curOffset = curText.indexOf(curPath, curOffset + curPath.length)) {
840852
let message: string;
@@ -861,7 +873,7 @@ export class CppProperties {
861873
}
862874
let diagnostic: vscode.Diagnostic = new vscode.Diagnostic(
863875
new vscode.Range(document.positionAt(curTextStartOffset + curOffset),
864-
document.positionAt(curTextStartOffset + curOffset + curPath.length + (!isCompilerPath ? - 1 : 0))),
876+
document.positionAt(curTextStartOffset + curOffset + curPath.length + (!isCompilerPath ? -1 : 0))),
865877
message, vscode.DiagnosticSeverity.Warning);
866878
diagnostics.push(diagnostic);
867879
}

0 commit comments

Comments
 (0)