Skip to content

Commit f5d1567

Browse files
authored
Fix old cached updateChannel default being used after package.json modification. (#8032)
* Fix old cached extension being used after package.json modification. * Limit it to when updateChannel is changed.
1 parent ccfc40a commit f5d1567

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Extension/src/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,23 @@ function rewriteManifest(): Promise<void> {
460460
"onFileSystem:cpptools-schema"
461461
];
462462

463+
let doTouchExtension: boolean = false;
464+
463465
const packageJsonPath: string = util.getExtensionFilePath("package.json");
464466
if (packageJsonPath.includes(".vscode-insiders") ||
465467
packageJsonPath.includes(".vscode-server-insiders") ||
466468
packageJsonPath.includes(".vscode-exploration") ||
467469
packageJsonPath.includes(".vscode-server-exploration")) {
468470
if (packageJson.contributes.configuration.properties['C_Cpp.updateChannel'].default === 'Default') {
469471
packageJson.contributes.configuration.properties['C_Cpp.updateChannel'].default = 'Insiders';
472+
doTouchExtension = true;
470473
}
471474
}
472475

473-
return util.writeFileText(util.getPackageJsonPath(), util.stringifyPackageJson(packageJson));
476+
return util.writeFileText(util.getPackageJsonPath(), util.stringifyPackageJson(packageJson)).then(() => {
477+
if (doTouchExtension) {
478+
// This is required to prevent VS Code from using the cached version with the old updateChannel setting.
479+
util.touchExtensionFolder();
480+
}
481+
});
474482
}

0 commit comments

Comments
 (0)