improve: show notification for unsupported platform
This commit is contained in:
parent
b08d8219ac
commit
79c9b0d0f4
2 changed files with 68 additions and 3 deletions
|
|
@ -6,12 +6,40 @@ import * as vscode from "vscode";
|
|||
|
||||
import { VsCodeExtension } from "../extension/VsCodeExtension";
|
||||
import registerQuickFixProvider from "../lang-server/codeActions";
|
||||
import { getExtensionVersion } from "../util/util";
|
||||
import {
|
||||
getArchitecture,
|
||||
getExtensionVersion,
|
||||
getPlatform,
|
||||
isUnsupportedPlatform,
|
||||
} from "../util/util";
|
||||
|
||||
import { VsCodeContinueApi } from "./api";
|
||||
import setupInlineTips from "./InlineTipManager";
|
||||
|
||||
export async function activateExtension(context: vscode.ExtensionContext) {
|
||||
const platformCheck = isUnsupportedPlatform();
|
||||
if (platformCheck.isUnsupported) {
|
||||
const platformTarget = `${getPlatform()}-${getArchitecture()}`;
|
||||
void vscode.window.showErrorMessage(
|
||||
`Continue extension cannot activate on ${platformTarget}: ${platformCheck.reason}`,
|
||||
);
|
||||
const error = new Error(
|
||||
`Continue extension cannot activate on ${platformTarget}: ${platformCheck.reason}`,
|
||||
);
|
||||
|
||||
void Telemetry.capture(
|
||||
"unsupported_platform_activation_attempt",
|
||||
{
|
||||
platform: platformTarget,
|
||||
extensionVersion: getExtensionVersion(),
|
||||
reason: platformCheck.reason,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Add necessary files
|
||||
getTsConfigPath();
|
||||
getContinueRcPath();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as vscode from "vscode";
|
||||
import * as os from "node:os";
|
||||
|
||||
const os = require("node:os");
|
||||
import * as vscode from "vscode";
|
||||
|
||||
function charIsEscapedAtIndex(index: number, str: string): boolean {
|
||||
if (index === 0) {
|
||||
|
|
@ -70,6 +70,7 @@ export function debounced(delay: number, fn: (...args: any[]) => void) {
|
|||
}
|
||||
|
||||
type Platform = "mac" | "linux" | "windows" | "unknown";
|
||||
type Architecture = "x64" | "arm64" | "unknown";
|
||||
|
||||
export function getPlatform(): Platform {
|
||||
const platform = os.platform();
|
||||
|
|
@ -84,6 +85,42 @@ export function getPlatform(): Platform {
|
|||
}
|
||||
}
|
||||
|
||||
export function getArchitecture(): Architecture {
|
||||
const arch = os.arch();
|
||||
if (arch === "x64" || arch === "ia32") {
|
||||
return "x64";
|
||||
} else if (arch === "arm64" || arch === "arm") {
|
||||
return "arm64";
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
export function isUnsupportedPlatform(): {
|
||||
isUnsupported: boolean;
|
||||
reason?: string;
|
||||
} {
|
||||
const platform = getPlatform();
|
||||
const arch = getArchitecture();
|
||||
|
||||
if (platform === "mac" && arch === "arm64") {
|
||||
return {
|
||||
isUnsupported: true,
|
||||
reason:
|
||||
"Windows ARM64 is not currently supported due to missing native dependencies (sqlite3, onnxruntime). Please use the extension on Windows x64, macOS, or Linux instead.",
|
||||
};
|
||||
}
|
||||
|
||||
if (platform === "unknown" || arch === "unknown") {
|
||||
return {
|
||||
isUnsupported: true,
|
||||
reason: `Unsupported platform combination: ${os.platform()}-${os.arch()}. Continue extension supports Windows x64, macOS (Intel/Apple Silicon), and Linux (x64/ARM64).`,
|
||||
};
|
||||
}
|
||||
|
||||
return { isUnsupported: false };
|
||||
}
|
||||
|
||||
export function getAltOrOption() {
|
||||
if (getPlatform() === "mac") {
|
||||
return "⌥";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue