Skip to content

Commit c18592b

Browse files
authored
Merge pull request #3332 from Microsoft/0_22_1_release
0 22 1 release
2 parents 717de54 + fee924b commit c18592b

File tree

9 files changed

+35
-27
lines changed

9 files changed

+35
-27
lines changed

Extension/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# C/C++ for Visual Studio Code Change Log
22

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+
38
## Version 0.22.0: March 19, 2019
49
### Major Changes
510
* 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)

Extension/ReleaseNotes.html

+1-1
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-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Extension/package.json

+5-5
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",
5+
"version": "0.22.1",
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

+1-1
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

+4-1
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

+5-7
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/extension.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function activate(activationEventOccurred: boolean): void {
7171

7272
taskProvider = vscode.tasks.registerTaskProvider(taskSourceStr, {
7373
provideTasks: () => {
74-
return getBuildTasks();
74+
return getBuildTasks(false);
7575
},
7676
resolveTask(task: vscode.Task): vscode.Task {
7777
// Currently cannot implement because VS Code does not call this. Can implement custom output file directory when enabled.
@@ -114,7 +114,7 @@ export interface BuildTaskDefinition extends vscode.TaskDefinition {
114114
/**
115115
* Generate tasks to build the current file based on the user's detected compilers, the user's compilerPath setting, and the current file's extension.
116116
*/
117-
export async function getBuildTasks(): Promise<vscode.Task[]> {
117+
export async function getBuildTasks(returnComplerPath: boolean): Promise<vscode.Task[]> {
118118
const editor: vscode.TextEditor = vscode.window.activeTextEditor;
119119
if (!editor) {
120120
return [];
@@ -243,6 +243,10 @@ export async function getBuildTasks(): Promise<vscode.Task[]> {
243243
task.definition = kind; // The constructor for vscode.Task will eat the definition. Reset it by reassigning.
244244
task.group = vscode.TaskGroup.Build;
245245

246+
if (!returnComplerPath) {
247+
delete task.definition.compilerPath;
248+
}
249+
246250
return task;
247251
});
248252
}

Extension/src/common.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export function setExtensionContext(context: vscode.ExtensionContext): void {
2323
extensionContext = context;
2424
}
2525

26+
export const failedToParseTasksJson: string = "Failed to parse tasks.json, possibly due to comments or trailing commas.";
27+
2628
// Use this package.json to read values
2729
export const packageJson: any = vscode.extensions.getExtension("ms-vscode.cpptools").packageJSON;
2830

@@ -47,11 +49,13 @@ export function getRawTasksJson(): Promise<any> {
4749
if (!exists) {
4850
return resolve({});
4951
}
50-
const fileContents: Buffer = fs.readFileSync(path);
52+
let fileContents: string = fs.readFileSync(path).toString();
53+
fileContents = fileContents.replace(/^\s*\/\/.*$/gm, ""); // Remove start of line // comments.
5154
let rawTasks: any = {};
5255
try {
53-
rawTasks = JSON.parse(fileContents.toString());
56+
rawTasks = JSON.parse(fileContents);
5457
} catch (error) {
58+
return reject(new Error(failedToParseTasksJson));
5559
}
5660
resolve(rawTasks);
5761
});
@@ -73,16 +77,10 @@ export async function ensureBuildTaskExists(taskName: string): Promise<void> {
7377
return;
7478
}
7579

76-
const buildTasks: vscode.Task[] = await getBuildTasks();
80+
const buildTasks: vscode.Task[] = await getBuildTasks(false);
7781
selectedTask = buildTasks.find(task => task.name === taskName);
7882
console.assert(selectedTask);
7983

80-
let definition: vscode.TaskDefinition = selectedTask.definition as vscode.TaskDefinition;
81-
if (definition && definition.compilerPath) {
82-
// TODO: add desired properties to empty object, don't delete.
83-
delete definition.compilerPath;
84-
}
85-
8684
rawTasksJson.version = "2.0.0";
8785

8886
if (!rawTasksJson.tasks.find(task => { return task.label === selectedTask.definition.label; })) {

0 commit comments

Comments
 (0)