Skip to content

Commit 88f0bbe

Browse files
authored
Merge pull request #8669 from microsoft/main
2 parents 7b175d4 + 75fc2a8 commit 88f0bbe

File tree

6 files changed

+79
-167
lines changed

6 files changed

+79
-167
lines changed

.github/actions/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"@actions/github": "^2.1.1",
1515
"axios": "^0.21.4"
1616
},
17+
"resolutions": {
18+
"follow-redirects": "1.14.7"
19+
},
1720
"devDependencies": {
1821
"eslint": "^8.1.0",
1922
"typescript": "^3.8.3"

Extension/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,32 +4391,32 @@
43914391
"xml2js": "^0.4.19"
43924392
},
43934393
"dependencies": {
4394-
"comment-json": "^3.0.3",
4394+
"comment-json": "^4.1.1",
43954395
"editorconfig": "^0.15.3",
43964396
"escape-string-regexp": "^2.0.0",
43974397
"https-proxy-agent": "^2.2.4",
43984398
"minimatch": "^3.0.4",
4399-
"mkdirp": "^0.5.1",
4399+
"mkdirp": "^0.5.5",
44004400
"plist": "^3.0.4",
4401-
"tmp": "^0.1.0",
4401+
"tmp": "^0.2.1",
44024402
"vscode-cpptools": "^5.0.0",
4403-
"vscode-extension-telemetry": "^0.1.7",
4403+
"vscode-extension-telemetry": "^0.4.4",
44044404
"vscode-languageclient": "^5.2.1",
4405-
"vscode-nls": "^4.1.1",
4406-
"vscode-tas-client": "^0.1.22",
4405+
"vscode-nls": "^5.0.0",
4406+
"vscode-tas-client": "^0.1.27",
44074407
"which": "^2.0.2",
44084408
"yauzl": "^2.10.0"
44094409
},
44104410
"resolutions": {
44114411
"**/mkdirp/minimist": "^0.2.1",
4412+
"follow-redirects": "1.14.7",
44124413
"ansi-regex": "^5.0.1",
44134414
"yargs-parser": "^15.0.1",
44144415
"y18n": "^5.0.5",
44154416
"hosted-git-info": "^3.0.8",
44164417
"browserslist": "^4.16.6",
44174418
"glob-parent": "^5.1.2",
44184419
"path-parse": "^1.0.7",
4419-
"axios": "^0.21.4",
44204420
"set-value": "^4.0.1"
44214421
}
44224422
}

Extension/src/LanguageServer/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import * as yauzl from 'yauzl';
2424
import { Readable } from 'stream';
2525
import * as nls from 'vscode-nls';
2626
import { CppBuildTaskProvider } from './cppBuildTaskProvider';
27-
import { HandleInsidersPrompt } from '../main';
27+
import { UpdateInsidersAccess } from '../main';
2828

2929
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
3030
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
@@ -299,8 +299,8 @@ function onDidChangeSettings(event: vscode.ConfigurationChangeEvent): void {
299299
});
300300

301301
const newUpdateChannel: string = changedActiveClientSettings['updateChannel'];
302-
if (newUpdateChannel) {
303-
HandleInsidersPrompt();
302+
if (newUpdateChannel || event.affectsConfiguration("extensions.autoUpdate")) {
303+
UpdateInsidersAccess();
304304
}
305305
}
306306

Extension/src/main.ts

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@ import * as path from 'path';
1111
import * as Telemetry from './telemetry';
1212
import * as util from './common';
1313
import * as vscode from 'vscode';
14-
import * as nls from 'vscode-nls';
1514

1615
import { CppToolsApi, CppToolsExtension } from 'vscode-cpptools';
1716
import { PlatformInformation } from './platform';
1817
import { CppTools1 } from './cppTools1';
1918
import { CppSettings } from './LanguageServer/settings';
2019
import { PersistentState } from './LanguageServer/persistentState';
21-
import { TargetPopulation } from 'vscode-tas-client';
22-
23-
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
24-
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
2520

2621
const cppTools: CppTools1 = new CppTools1();
2722
let languageServiceDisabled: boolean = false;
@@ -82,7 +77,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
8277
}
8378
LanguageServer.activate();
8479

85-
HandleInsidersPrompt();
80+
UpdateInsidersAccess();
8681

8782
return cppTools;
8883
}
@@ -134,39 +129,20 @@ function sendTelemetry(info: PlatformInformation): void {
134129
Telemetry.logDebuggerEvent("acquisition", telemetryProperties);
135130
}
136131

137-
export function HandleInsidersPrompt(): void {
138-
// Only display this prompt to users who have updateChannel configured for Insiders,
139-
// and who are not already configured to receive pre-release extensions.
140-
141-
const targetPopulation: TargetPopulation = util.getCppToolsTargetPopulation();
142-
// Skip the prompt if already using an insiders build of cpptools.
143-
if (targetPopulation === TargetPopulation.Public) {
144-
const settings: CppSettings = new CppSettings();
145-
const displayedInsidersPrompt: PersistentState<boolean> = new PersistentState<boolean>("CPP.displayedInsidersPrompt", false);
146-
// Skip the prompt if updateChannel was not set to Insiders.
147-
if (settings.updateChannel === "Insiders") {
148-
if (!displayedInsidersPrompt.Value) {
149-
displayedInsidersPrompt.Value = true;
150-
const message: string = localize('updateChannel.changed', "The `C_Cpp.updateChannel` setting is deprecated. Do you want to enable install of pre-releases of the C/C++ extension via the Marketplace?");
151-
const yes: string = localize("yes.button", "Yes");
152-
const no: string = localize("no.button", "No");
153-
vscode.window.showInformationMessage(message, yes, no).then((selection) => {
154-
switch (selection) {
155-
case yes:
156-
vscode.commands.executeCommand("workbench.extensions.installExtension", "ms-vscode.cpptools", { installPreReleaseVersion: true });
157-
break;
158-
case no:
159-
break;
160-
default:
161-
break;
162-
}
163-
});
164-
}
165-
} else {
166-
// Reset persistent value, so we prompt again if they switch to "Insiders" again.
167-
if (displayedInsidersPrompt.Value) {
168-
displayedInsidersPrompt.Value = false;
169-
}
132+
export function UpdateInsidersAccess(): void {
133+
// Only move them to the new prerelease mechanism if using updateChannel of Insiders.
134+
const settings: CppSettings = new CppSettings();
135+
const migratedInsiders: PersistentState<boolean> = new PersistentState<boolean>("CPP.migratedInsiders", false);
136+
if (settings.updateChannel === "Insiders") {
137+
// Don't do anything while the user has autoUpdate disabled, so we do not cause the extension to be updated.
138+
if (!migratedInsiders.Value && vscode.workspace.getConfiguration("extensions", null).get<boolean>("autoUpdate")) {
139+
migratedInsiders.Value = true;
140+
vscode.commands.executeCommand("workbench.extensions.installExtension", "ms-vscode.cpptools", { installPreReleaseVersion: true });
141+
}
142+
} else {
143+
// Reset persistent value, so we register again if they switch to "Insiders" again.
144+
if (migratedInsiders.Value) {
145+
migratedInsiders.Value = false;
170146
}
171147
}
172148
}

0 commit comments

Comments
 (0)