Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
380dcbbb58 | ||
|
|
0a002db1e5 | ||
|
|
b5b1c2b9df | ||
|
|
dd8f358076 | ||
|
|
34cd49174e | ||
|
|
2874fd2600 |
@@ -1,5 +1,9 @@
|
||||
# C/C++ for Visual Studio Code Change Log
|
||||
|
||||
## Version 1.9.8: April 20, 2022
|
||||
### Bug Fixes
|
||||
* Fix an issue with extension activation failing if `C_Cpp.intelliSenseEngine` was set to `Disabled`. [#9083](https://github.com/microsoft/vscode-cpptools/issues/9083)
|
||||
|
||||
## Version 1.9.7: March 23, 2022
|
||||
### New Features
|
||||
* Add debugger support for Apple M1 (osx-arm64). [#7035](https://github.com/microsoft/vscode-cpptools/issues/7035)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "cpptools",
|
||||
"displayName": "C/C++",
|
||||
"description": "C/C++ IntelliSense, debugging, and code browsing.",
|
||||
"version": "1.9.7-main",
|
||||
"version": "1.9.8-main",
|
||||
"publisher": "ms-vscode",
|
||||
"icon": "LanguageCCPP_color_128x.png",
|
||||
"readme": "README.md",
|
||||
@@ -2755,6 +2755,8 @@
|
||||
"cpp",
|
||||
"cuda-cpp"
|
||||
],
|
||||
"_aiKeyComment": "Ignore 'Property aiKey is not allowed'. See https://github.com/microsoft/vscode/issues/76493",
|
||||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"variables": {
|
||||
"pickProcess": "extension.pickNativeProcess",
|
||||
"pickRemoteProcess": "extension.pickRemoteNativeProcess"
|
||||
@@ -3430,6 +3432,8 @@
|
||||
"cpp",
|
||||
"cuda-cpp"
|
||||
],
|
||||
"_aiKeyComment": "Ignore 'Property aiKey is not allowed'. See https://github.com/microsoft/vscode/issues/76493",
|
||||
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
|
||||
"variables": {
|
||||
"pickProcess": "extension.pickNativeProcess"
|
||||
},
|
||||
|
||||
@@ -7,17 +7,17 @@ import * as debugUtils from './utils';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { CppBuildTask, CppBuildTaskDefinition } from '../LanguageServer/cppBuildTaskProvider';
|
||||
import { CppBuildTask, CppBuildTaskDefinition, cppBuildTaskProvider } from '../LanguageServer/cppBuildTaskProvider';
|
||||
import * as util from '../common';
|
||||
import * as fs from 'fs';
|
||||
import * as Telemetry from '../telemetry';
|
||||
import { cppBuildTaskProvider, configPrefix } from '../LanguageServer/extension';
|
||||
import * as logger from '../logger';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { IConfiguration, IConfigurationSnippet, DebuggerType, DebuggerEvent, MIConfigurations, WindowsConfigurations, WSLConfigurations, PipeTransportConfigurations, TaskConfigStatus } from './configurations';
|
||||
import { parse } from 'comment-json';
|
||||
import { PlatformInformation } from '../platform';
|
||||
import { Environment, ParsedEnvironmentFile } from './ParsedEnvironmentFile';
|
||||
import { configPrefix } from '../LanguageServer/extension';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
|
||||
@@ -94,10 +94,6 @@ export class CppBuildTaskProvider implements TaskProvider {
|
||||
try {
|
||||
activeClient = ext.getActiveClient();
|
||||
} catch (errJS) {
|
||||
const e: Error = errJS as Error;
|
||||
if (!e || e.message !== ext.intelliSenseDisabledError) {
|
||||
console.error("Unknown error calling getActiveClient().");
|
||||
}
|
||||
return emptyTasks; // Language service features may be disabled.
|
||||
}
|
||||
|
||||
@@ -347,6 +343,8 @@ export class CppBuildTaskProvider implements TaskProvider {
|
||||
|
||||
}
|
||||
|
||||
export const cppBuildTaskProvider: CppBuildTaskProvider = new CppBuildTaskProvider();
|
||||
|
||||
class CustomBuildTaskTerminal implements Pseudoterminal {
|
||||
private writeEmitter = new EventEmitter<string>();
|
||||
private closeEmitter = new EventEmitter<number>();
|
||||
|
||||
@@ -25,12 +25,9 @@ import { Readable } from 'stream';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { CppBuildTaskProvider } from './cppBuildTaskProvider';
|
||||
import { UpdateInsidersAccess } from '../main';
|
||||
import { PlatformInformation } from '../platform';
|
||||
import * as semver from 'semver';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
export const cppBuildTaskProvider: CppBuildTaskProvider = new CppBuildTaskProvider();
|
||||
export const CppSourceStr: string = "C/C++";
|
||||
export const configPrefix: string = "C/C++: ";
|
||||
|
||||
@@ -41,7 +38,6 @@ let ui: UI;
|
||||
const disposables: vscode.Disposable[] = [];
|
||||
let languageConfigurations: vscode.Disposable[] = [];
|
||||
let intervalTimer: NodeJS.Timer;
|
||||
let taskProvider: vscode.Disposable;
|
||||
let codeActionProvider: vscode.Disposable;
|
||||
export const intelliSenseDisabledError: string = "Do not activate the extension when IntelliSense is disabled.";
|
||||
|
||||
@@ -157,129 +153,20 @@ function sendActivationTelemetry(): void {
|
||||
telemetry.logLanguageServerEvent("Activate", activateEvent);
|
||||
}
|
||||
|
||||
async function checkVsixCompatibility(): Promise<void> {
|
||||
const ignoreMismatchedCompatibleVsix: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".ignoreMismatchedCompatibleVsix", false);
|
||||
let resetIgnoreMismatchedCompatibleVsix: boolean = true;
|
||||
|
||||
// Check to ensure the correct platform-specific VSIX was installed.
|
||||
const vsixManifestPath: string = path.join(util.extensionPath, ".vsixmanifest");
|
||||
// Skip the check if the file does not exist, such as when debugging cpptools.
|
||||
if (await util.checkFileExists(vsixManifestPath)) {
|
||||
const content: string = await util.readFileText(vsixManifestPath);
|
||||
const matches: RegExpMatchArray | null = content.match(/TargetPlatform="(?<platform>[^"]*)"/);
|
||||
if (matches && matches.length > 0 && matches.groups) {
|
||||
const vsixTargetPlatform: string = matches.groups['platform'];
|
||||
const platformInfo: PlatformInformation = await PlatformInformation.GetPlatformInformation();
|
||||
let isPlatformCompatible: boolean = true;
|
||||
let isPlatformMatching: boolean = true;
|
||||
switch (vsixTargetPlatform) {
|
||||
case "win32-x64":
|
||||
isPlatformMatching = platformInfo.platform === "win32" && platformInfo.architecture === "x64";
|
||||
// x64 binaries can also be run on arm64 Windows 11.
|
||||
isPlatformCompatible = platformInfo.platform === "win32" && (platformInfo.architecture === "x64" || (platformInfo.architecture === "arm64" && semver.gte(os.release(), "10.0.22000")));
|
||||
break;
|
||||
case "win32-ia32":
|
||||
isPlatformMatching = platformInfo.platform === "win32" && platformInfo.architecture === "x86";
|
||||
// x86 binaries can also be run on x64 and arm64 Windows.
|
||||
isPlatformCompatible = platformInfo.platform === "win32" && (platformInfo.architecture === "x86" || platformInfo.architecture === "x64" || platformInfo.architecture === "arm64");
|
||||
break;
|
||||
case "win32-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "win32" && platformInfo.architecture === "arm64";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "linux-x64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "x64" && platformInfo.distribution?.name !== "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "linux-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "arm64" && platformInfo.distribution?.name !== "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "linux-armhf":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "arm" && platformInfo.distribution?.name !== "alpine";
|
||||
// armhf binaries can also be run on aarch64 linux.
|
||||
isPlatformCompatible = platformInfo.platform === "linux" && (platformInfo.architecture === "arm" || platformInfo.architecture === "arm64") && platformInfo.distribution?.name !== "alpine";
|
||||
break;
|
||||
case "alpine-x64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "x64" && platformInfo.distribution?.name === "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "alpine-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "arm64" && platformInfo.distribution?.name === "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "darwin-x64":
|
||||
isPlatformMatching = platformInfo.platform === "darwin" && platformInfo.architecture === "x64";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "darwin-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "darwin" && platformInfo.architecture === "arm64";
|
||||
// x64 binaries can also be run on arm64 macOS.
|
||||
isPlatformCompatible = platformInfo.platform === "darwin" && (platformInfo.architecture === "x64" || platformInfo.architecture === "arm64");
|
||||
break;
|
||||
default:
|
||||
console.log("Unrecognized TargetPlatform in .vsixmanifest");
|
||||
break;
|
||||
}
|
||||
const moreInfoButton: string = localize("more.info.button", "More Info");
|
||||
const ignoreButton: string = localize("ignore.button", "Ignore");
|
||||
let promise: Thenable<string | undefined> | undefined;
|
||||
if (!isPlatformCompatible) {
|
||||
promise = vscode.window.showErrorMessage(localize("vsix.platform.incompatible", "The C/C++ extension installed does not match your system.", vsixTargetPlatform), moreInfoButton);
|
||||
} else if (!isPlatformMatching) {
|
||||
if (!ignoreMismatchedCompatibleVsix.Value) {
|
||||
resetIgnoreMismatchedCompatibleVsix = false;
|
||||
promise = vscode.window.showWarningMessage(localize("vsix.platform.mismatching", "The C/C++ extension installed is compatible with but does not match your system.", vsixTargetPlatform), moreInfoButton, ignoreButton);
|
||||
}
|
||||
}
|
||||
if (promise) {
|
||||
promise.then(async (value) => {
|
||||
if (value === moreInfoButton) {
|
||||
await vscode.commands.executeCommand("markdown.showPreview", vscode.Uri.file(util.getLocalizedHtmlPath("Reinstalling the Extension.md")));
|
||||
} else if (value === ignoreButton) {
|
||||
ignoreMismatchedCompatibleVsix.Value = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("Unable to find TargetPlatform in .vsixmanifest");
|
||||
}
|
||||
}
|
||||
if (resetIgnoreMismatchedCompatibleVsix) {
|
||||
ignoreMismatchedCompatibleVsix.Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* activate: set up the extension for language services
|
||||
*/
|
||||
export async function activate(): Promise<void> {
|
||||
|
||||
await checkVsixCompatibility();
|
||||
|
||||
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) {
|
||||
for (let i: number = 0; i < vscode.workspace.workspaceFolders.length; ++i) {
|
||||
const config: string = path.join(vscode.workspace.workspaceFolders[i].uri.fsPath, ".vscode/c_cpp_properties.json");
|
||||
if (await util.checkFileExists(config)) {
|
||||
const doc: vscode.TextDocument = await vscode.workspace.openTextDocument(config);
|
||||
vscode.languages.setTextDocumentLanguage(doc, "jsonc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined).intelliSenseEngine === "Disabled") {
|
||||
throw new Error(intelliSenseDisabledError);
|
||||
} else {
|
||||
console.log("activating extension");
|
||||
sendActivationTelemetry();
|
||||
const checkForConflictingExtensions: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".checkForConflictingExtensions", true);
|
||||
if (checkForConflictingExtensions.Value) {
|
||||
checkForConflictingExtensions.Value = false;
|
||||
const clangCommandAdapterActive: boolean = vscode.extensions.all.some((extension: vscode.Extension<any>, index: number, array: Readonly<vscode.Extension<any>[]>): boolean =>
|
||||
extension.isActive && extension.id === "mitaki28.vscode-clang");
|
||||
if (clangCommandAdapterActive) {
|
||||
telemetry.logLanguageServerEvent("conflictingExtension");
|
||||
}
|
||||
console.log("activating extension");
|
||||
sendActivationTelemetry();
|
||||
const checkForConflictingExtensions: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".checkForConflictingExtensions", true);
|
||||
if (checkForConflictingExtensions.Value) {
|
||||
checkForConflictingExtensions.Value = false;
|
||||
const clangCommandAdapterActive: boolean = vscode.extensions.all.some((extension: vscode.Extension<any>, index: number, array: Readonly<vscode.Extension<any>[]>): boolean =>
|
||||
extension.isActive && extension.id === "mitaki28.vscode-clang");
|
||||
if (clangCommandAdapterActive) {
|
||||
telemetry.logLanguageServerEvent("conflictingExtension");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,21 +198,14 @@ export async function activate(): Promise<void> {
|
||||
|
||||
registerCommands();
|
||||
|
||||
taskProvider = vscode.tasks.registerTaskProvider(CppBuildTaskProvider.CppBuildScriptType, cppBuildTaskProvider);
|
||||
|
||||
vscode.tasks.onDidStartTask(event => {
|
||||
getActiveClient().PauseCodeAnalysis();
|
||||
if (event.execution.task.definition.type === CppBuildTaskProvider.CppBuildScriptType
|
||||
|| event.execution.task.name.startsWith(configPrefix)) {
|
||||
telemetry.logLanguageServerEvent('buildTaskStarted');
|
||||
}
|
||||
});
|
||||
|
||||
vscode.tasks.onDidEndTask(event => {
|
||||
getActiveClient().ResumeCodeAnalysis();
|
||||
if (event.execution.task.definition.type === CppBuildTaskProvider.CppBuildScriptType
|
||||
|| event.execution.task.name.startsWith(configPrefix)) {
|
||||
telemetry.logLanguageServerEvent('buildTaskFinished');
|
||||
if (event.execution.task.scope !== vscode.TaskScope.Global && event.execution.task.scope !== vscode.TaskScope.Workspace) {
|
||||
const folder: vscode.WorkspaceFolder | undefined = event.execution.task.scope;
|
||||
if (folder) {
|
||||
@@ -1032,9 +912,6 @@ export function deactivate(): Thenable<void> {
|
||||
disposables.forEach(d => d.dispose());
|
||||
languageConfigurations.forEach(d => d.dispose());
|
||||
ui.dispose();
|
||||
if (taskProvider) {
|
||||
taskProvider.dispose();
|
||||
}
|
||||
if (codeActionProvider) {
|
||||
codeActionProvider.dispose();
|
||||
}
|
||||
|
||||
+146
-16
@@ -18,6 +18,12 @@ import { CppTools1 } from './cppTools1';
|
||||
import { CppSettings } from './LanguageServer/settings';
|
||||
import { PersistentState } from './LanguageServer/persistentState';
|
||||
import { TargetPopulation } from 'vscode-tas-client';
|
||||
import * as semver from 'semver';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { cppBuildTaskProvider, CppBuildTaskProvider } from './LanguageServer/cppBuildTaskProvider';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
|
||||
|
||||
const cppTools: CppTools1 = new CppTools1();
|
||||
let languageServiceDisabled: boolean = false;
|
||||
@@ -58,27 +64,59 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
|
||||
|
||||
// Notify users if debugging may not be supported on their OS.
|
||||
util.checkDistro(info);
|
||||
await checkVsixCompatibility();
|
||||
UpdateInsidersAccess();
|
||||
|
||||
const settings: CppSettings = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined);
|
||||
if (settings.intelliSenseEngine === "Disabled") {
|
||||
languageServiceDisabled = true;
|
||||
disposables.push(vscode.workspace.onDidChangeConfiguration(() => {
|
||||
if (!reloadMessageShown && settings.intelliSenseEngine !== "Disabled") {
|
||||
reloadMessageShown = true;
|
||||
util.promptForReloadWindowDueToSettingsChange();
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
disposables.push(vscode.workspace.onDidChangeConfiguration(() => {
|
||||
if (!reloadMessageShown && settings.intelliSenseEngine === "Disabled") {
|
||||
reloadMessageShown = true;
|
||||
util.promptForReloadWindowDueToSettingsChange();
|
||||
}
|
||||
}));
|
||||
}
|
||||
await LanguageServer.activate();
|
||||
let currentIntelliSenseEngineValue: string | undefined = settings.intelliSenseEngine;
|
||||
disposables.push(vscode.workspace.onDidChangeConfiguration(() => {
|
||||
const settings: CppSettings = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined);
|
||||
if (!reloadMessageShown && settings.intelliSenseEngine !== currentIntelliSenseEngineValue) {
|
||||
if (currentIntelliSenseEngineValue === "Disabled") {
|
||||
// If switching from disabled to enabled, we can continue activation.
|
||||
currentIntelliSenseEngineValue = settings.intelliSenseEngine;
|
||||
languageServiceDisabled = false;
|
||||
LanguageServer.activate();
|
||||
} else {
|
||||
// We can't deactivate or change engines on the fly, so prompt for window reload.
|
||||
reloadMessageShown = true;
|
||||
util.promptForReloadWindowDueToSettingsChange();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
UpdateInsidersAccess();
|
||||
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) {
|
||||
for (let i: number = 0; i < vscode.workspace.workspaceFolders.length; ++i) {
|
||||
const config: string = path.join(vscode.workspace.workspaceFolders[i].uri.fsPath, ".vscode/c_cpp_properties.json");
|
||||
if (await util.checkFileExists(config)) {
|
||||
const doc: vscode.TextDocument = await vscode.workspace.openTextDocument(config);
|
||||
vscode.languages.setTextDocumentLanguage(doc, "jsonc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
disposables.push(vscode.tasks.registerTaskProvider(CppBuildTaskProvider.CppBuildScriptType, cppBuildTaskProvider));
|
||||
|
||||
vscode.tasks.onDidStartTask(event => {
|
||||
if (event.execution.task.definition.type === CppBuildTaskProvider.CppBuildScriptType
|
||||
|| event.execution.task.name.startsWith(LanguageServer.configPrefix)) {
|
||||
Telemetry.logLanguageServerEvent('buildTaskStarted');
|
||||
}
|
||||
});
|
||||
|
||||
vscode.tasks.onDidEndTask(event => {
|
||||
if (event.execution.task.definition.type === CppBuildTaskProvider.CppBuildScriptType
|
||||
|| event.execution.task.name.startsWith(LanguageServer.configPrefix)) {
|
||||
Telemetry.logLanguageServerEvent('buildTaskFinished');
|
||||
}
|
||||
});
|
||||
|
||||
if (settings.intelliSenseEngine !== "Disabled") {
|
||||
await LanguageServer.activate();
|
||||
}
|
||||
|
||||
return cppTools;
|
||||
}
|
||||
@@ -87,7 +125,6 @@ export function deactivate(): Thenable<void> {
|
||||
DebuggerExtension.dispose();
|
||||
Telemetry.deactivate();
|
||||
disposables.forEach(d => d.dispose());
|
||||
|
||||
if (languageServiceDisabled) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
@@ -187,3 +224,96 @@ export function UpdateInsidersAccess(): void {
|
||||
vscode.commands.executeCommand("workbench.extensions.installExtension", "ms-vscode.cpptools", { installPreReleaseVersion: true });
|
||||
}
|
||||
}
|
||||
|
||||
async function checkVsixCompatibility(): Promise<void> {
|
||||
const ignoreMismatchedCompatibleVsix: PersistentState<boolean> = new PersistentState<boolean>("CPP." + util.packageJson.version + ".ignoreMismatchedCompatibleVsix", false);
|
||||
let resetIgnoreMismatchedCompatibleVsix: boolean = true;
|
||||
|
||||
// Check to ensure the correct platform-specific VSIX was installed.
|
||||
const vsixManifestPath: string = path.join(util.extensionPath, ".vsixmanifest");
|
||||
// Skip the check if the file does not exist, such as when debugging cpptools.
|
||||
if (await util.checkFileExists(vsixManifestPath)) {
|
||||
const content: string = await util.readFileText(vsixManifestPath);
|
||||
const matches: RegExpMatchArray | null = content.match(/TargetPlatform="(?<platform>[^"]*)"/);
|
||||
if (matches && matches.length > 0 && matches.groups) {
|
||||
const vsixTargetPlatform: string = matches.groups['platform'];
|
||||
const platformInfo: PlatformInformation = await PlatformInformation.GetPlatformInformation();
|
||||
let isPlatformCompatible: boolean = true;
|
||||
let isPlatformMatching: boolean = true;
|
||||
switch (vsixTargetPlatform) {
|
||||
case "win32-x64":
|
||||
isPlatformMatching = platformInfo.platform === "win32" && platformInfo.architecture === "x64";
|
||||
// x64 binaries can also be run on arm64 Windows 11.
|
||||
isPlatformCompatible = platformInfo.platform === "win32" && (platformInfo.architecture === "x64" || (platformInfo.architecture === "arm64" && semver.gte(os.release(), "10.0.22000")));
|
||||
break;
|
||||
case "win32-ia32":
|
||||
isPlatformMatching = platformInfo.platform === "win32" && platformInfo.architecture === "x86";
|
||||
// x86 binaries can also be run on x64 and arm64 Windows.
|
||||
isPlatformCompatible = platformInfo.platform === "win32" && (platformInfo.architecture === "x86" || platformInfo.architecture === "x64" || platformInfo.architecture === "arm64");
|
||||
break;
|
||||
case "win32-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "win32" && platformInfo.architecture === "arm64";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "linux-x64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "x64" && platformInfo.distribution?.name !== "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "linux-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "arm64" && platformInfo.distribution?.name !== "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "linux-armhf":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "arm" && platformInfo.distribution?.name !== "alpine";
|
||||
// armhf binaries can also be run on aarch64 linux.
|
||||
isPlatformCompatible = platformInfo.platform === "linux" && (platformInfo.architecture === "arm" || platformInfo.architecture === "arm64") && platformInfo.distribution?.name !== "alpine";
|
||||
break;
|
||||
case "alpine-x64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "x64" && platformInfo.distribution?.name === "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "alpine-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "linux" && platformInfo.architecture === "arm64" && platformInfo.distribution?.name === "alpine";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "darwin-x64":
|
||||
isPlatformMatching = platformInfo.platform === "darwin" && platformInfo.architecture === "x64";
|
||||
isPlatformCompatible = isPlatformMatching;
|
||||
break;
|
||||
case "darwin-arm64":
|
||||
isPlatformMatching = platformInfo.platform === "darwin" && platformInfo.architecture === "arm64";
|
||||
// x64 binaries can also be run on arm64 macOS.
|
||||
isPlatformCompatible = platformInfo.platform === "darwin" && (platformInfo.architecture === "x64" || platformInfo.architecture === "arm64");
|
||||
break;
|
||||
default:
|
||||
console.log("Unrecognized TargetPlatform in .vsixmanifest");
|
||||
break;
|
||||
}
|
||||
const moreInfoButton: string = localize("more.info.button", "More Info");
|
||||
const ignoreButton: string = localize("ignore.button", "Ignore");
|
||||
let promise: Thenable<string | undefined> | undefined;
|
||||
if (!isPlatformCompatible) {
|
||||
promise = vscode.window.showErrorMessage(localize("vsix.platform.incompatible", "The C/C++ extension installed does not match your system.", vsixTargetPlatform), moreInfoButton);
|
||||
} else if (!isPlatformMatching) {
|
||||
if (!ignoreMismatchedCompatibleVsix.Value) {
|
||||
resetIgnoreMismatchedCompatibleVsix = false;
|
||||
promise = vscode.window.showWarningMessage(localize("vsix.platform.mismatching", "The C/C++ extension installed is compatible with but does not match your system.", vsixTargetPlatform), moreInfoButton, ignoreButton);
|
||||
}
|
||||
}
|
||||
if (promise) {
|
||||
promise.then(async (value) => {
|
||||
if (value === moreInfoButton) {
|
||||
await vscode.commands.executeCommand("markdown.showPreview", vscode.Uri.file(util.getLocalizedHtmlPath("Reinstalling the Extension.md")));
|
||||
} else if (value === ignoreButton) {
|
||||
ignoreMismatchedCompatibleVsix.Value = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("Unable to find TargetPlatform in .vsixmanifest");
|
||||
}
|
||||
}
|
||||
if (resetIgnoreMismatchedCompatibleVsix) {
|
||||
ignoreMismatchedCompatibleVsix.Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user