Skip to content

Commit aa0d66e

Browse files
authored
Merge pull request #3581 from WardenGnaw/dev/waan/checkPlatformAndArch
Add Error Message for Unsupported Platforms
2 parents 695d071 + a7c1f82 commit aa0d66e

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mono:
77
- latest
88

99
env:
10-
- CODE_VERSION=1.33.0
10+
- CODE_VERSION=1.36.0
1111

1212
before_install:
1313
- if [ $TRAVIS_OS_NAME == "linux" ]; then

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@
358358
}
359359
],
360360
"engines": {
361-
"vscode": "^1.31.0"
361+
"vscode": "^1.36.0"
362362
},
363363
"activationEvents": [
364364
"onDebugInitialConfigurations",

src/main.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
121121
eventStream.post(new ActivationFailure());
122122
}
123123

124+
if (!isSupportedPlatform(platformInfo)) {
125+
const platform: string = platformInfo.platform ? platformInfo.platform : "this platform";
126+
const architecture: string = platformInfo.architecture ? platformInfo.architecture : " and <unknown processor architecture>";
127+
let errorMessage: string = `The C# extension for Visual Studio Code (powered by OmniSharp) is incompatiable on ${platform} ${architecture}`;
128+
const messageOptions: vscode.MessageOptions = {
129+
};
130+
131+
// Check to see if VS Code is running remotely
132+
if (extension.extensionKind === vscode.ExtensionKind.Workspace) {
133+
const setupButton: string = "How to setup Remote Debugging";
134+
errorMessage += ` with the VS Code Remote Extensions. To see avaliable workarounds, click on '${setupButton}'.`;
135+
136+
await vscode.window.showErrorMessage(errorMessage, messageOptions, setupButton).then((selectedItem: string) => {
137+
if (selectedItem === setupButton) {
138+
let remoteDebugInfoURL = 'https://github.com/OmniSharp/omnisharp-vscode/wiki/Remote-Debugging-On-Linux-Arm';
139+
vscode.env.openExternal(vscode.Uri.parse(remoteDebugInfoURL));
140+
}
141+
});
142+
} else {
143+
await vscode.window.showErrorMessage(errorMessage, messageOptions);
144+
}
145+
146+
// Unsupported platform
147+
return null;
148+
}
149+
124150
let telemetryObserver = new TelemetryObserver(platformInfo, () => reporter);
125151
eventStream.subscribe(telemetryObserver.post);
126152

@@ -171,6 +197,24 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
171197
};
172198
}
173199

200+
function isSupportedPlatform(platform: PlatformInformation): boolean {
201+
if (platform.isWindows()) {
202+
return platform.architecture === "x86" || platform.architecture === "x86_64";
203+
}
204+
205+
if (platform.isMacOS()) {
206+
return true;
207+
}
208+
209+
if (platform.isLinux()) {
210+
return platform.architecture === "x86_64" ||
211+
platform.architecture === "x86" ||
212+
platform.architecture === "i686";
213+
}
214+
215+
return false;
216+
}
217+
174218
async function ensureRuntimeDependencies(extension: vscode.Extension<CSharpExtensionExports>, eventStream: EventStream, platformInfo: PlatformInformation, installDependencies: IInstallDependencies): Promise<boolean> {
175219
return installRuntimeDependencies(extension.packageJSON, extension.extensionPath, installDependencies, eventStream, platformInfo);
176220
}

src/platform.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ export class PlatformInformation {
191191
if (process.env.PROCESSOR_ARCHITECTURE === 'x86' && process.env.PROCESSOR_ARCHITEW6432 === undefined) {
192192
resolve('x86');
193193
}
194+
else if (process.env.PROCESSOR_ARCHITECTURE === 'ARM64' && process.env.PROCESSOR_ARCHITEW6432 === undefined) {
195+
resolve('ARM64');
196+
}
194197
else {
195198
resolve('x86_64');
196199
}

src/vscodeAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ export interface vscode {
943943
};
944944
extensions: {
945945
getExtension(extensionId: string): Extension<any> | undefined;
946-
all: Extension<any>[];
946+
all: ReadonlyArray<Extension<any>>;
947947
};
948948
Uri: {
949949
parse(value: string): Uri;

0 commit comments

Comments
 (0)