Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Acode is an open-source code editor and web IDE for Android. Edit projects, mana

LINUX TERMINAL

Acode includes an Alpine Linux terminal powered by proot, with no root required. Use apk to install supported command-line packages, keep multiple terminal tabs, customize your shell, and back up or restore your terminal setup.
Acode includes an Ubuntu Linux terminal powered by proot, with no root required. Use apt to install supported command-line packages, keep multiple terminal tabs, customize your shell, and back up or restore your terminal setup.

AI CODING SUPPORT

Expand Down
4 changes: 2 additions & 2 deletions src/cm/lsp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ export {
stopManagedServer,
} from "./serverLauncher";
export {
BUILTIN_ALPINE_RUNTIME_ID,
BUILTIN_UBUNTU_RUNTIME_ID,
EXTERNAL_WEBSOCKET_RUNTIME_ID,
getRuntimeProvider,
inferWorkspaceKind,
isBuiltinAlpineAccessible,
isBuiltinUbuntuAccessible,
listRuntimeProviders,
registerRuntimeProvider,
selectRuntimeProvider,
Expand Down
6 changes: 3 additions & 3 deletions src/cm/lsp/providerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ export function defineServer(options: ManagedServerOptions): LspServerManifest {
}

export const installers = {
apk(options: {
apt(options: {
packages: string[];
executable: string;
label?: string;
source?: string;
}): LauncherInstallConfig {
return {
kind: "apk",
source: options.source || "apk",
kind: "apt",
source: options.source || "apt",
label: options.label,
executable: options.executable,
packages: options.packages,
Expand Down
10 changes: 5 additions & 5 deletions src/cm/lsp/runtimeProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
} from "./types";
import { getConfiguredRuntimeId } from "./runtimeSettings";

export const BUILTIN_ALPINE_RUNTIME_ID = "builtin-alpine";
export const BUILTIN_UBUNTU_RUNTIME_ID = "builtin-ubuntu";
export const EXTERNAL_WEBSOCKET_RUNTIME_ID = "external-websocket";
export const WEB_WORKER_RUNTIME_ID = "web-worker";

Expand Down Expand Up @@ -188,13 +188,13 @@ export function inferWorkspaceKind(
if (scheme !== "content") return "unknown";

if (/^content:\/\/com\.foxdebug\.acode(?:free)?\.documents\//i.test(uri)) {
return "builtin-alpine";
return "builtin-ubuntu";
}
if (/termux/i.test(uri)) return "termux-saf";
return "saf";
}

export function isBuiltinAlpineAccessible(
export function isBuiltinUbuntuAccessible(
context: Pick<LspRuntimeContext, "uri" | "rootUri" | "file">,
): boolean {
const uri = String(context.rootUri || context.file?.uri || context.uri || "");
Expand All @@ -211,11 +211,11 @@ export function isBuiltinAlpineAccessible(
}

export default {
BUILTIN_ALPINE_RUNTIME_ID,
BUILTIN_UBUNTU_RUNTIME_ID,
WEB_WORKER_RUNTIME_ID,
getRuntimeProvider,
inferWorkspaceKind,
isBuiltinAlpineAccessible,
isBuiltinUbuntuAccessible,
listRuntimeProviders,
registerRuntimeProvider,
selectRuntimeProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import { createTransport } from "../transport";
import {
checkServerInstallation,
ensureServerRunning,
getInstallCommand as getAlpineInstallCommand,
getUninstallCommand as getAlpineUninstallCommand,
getInstallCommand as getUbuntuInstallCommand,
getUninstallCommand as getUbuntuUninstallCommand,
installServer,
uninstallServer,
} from "../serverLauncher";
import { isBuiltinAlpineAccessible } from "../runtimeProviders";
import { isBuiltinUbuntuAccessible } from "../runtimeProviders";
import type {
LspRuntimeContext,
LspRuntimeProvider,
LspServerDefinition,
LspRuntimeUriResolutionContext,
} from "../types";

export const BUILTIN_ALPINE_RUNTIME_ID = "builtin-alpine";
export const BUILTIN_UBUNTU_RUNTIME_ID = "builtin-ubuntu";

function isUntitled(context: LspRuntimeContext): boolean {
return /^untitled:/i.test(
Expand All @@ -40,16 +40,16 @@ function cacheDocumentUri(context: LspRuntimeContext): string | null {
}

function canUseRealPath(context: LspRuntimeContext): boolean {
return isBuiltinAlpineAccessible({
return isBuiltinUbuntuAccessible({
...context,
rootUri: context.originalRootUri || context.rootUri,
uri: context.originalDocumentUri || context.uri,
});
}

export const builtinAlpineRuntimeProvider: LspRuntimeProvider = {
id: BUILTIN_ALPINE_RUNTIME_ID,
label: "Built-in Alpine",
export const builtinUbuntuRuntimeProvider: LspRuntimeProvider = {
id: BUILTIN_UBUNTU_RUNTIME_ID,
label: "Built-in Ubuntu",
priority: -100,

canHandle(
Expand Down Expand Up @@ -78,7 +78,7 @@ export const builtinAlpineRuntimeProvider: LspRuntimeProvider = {
const documentUri = cacheDocumentUri(context);
if (!documentUri) {
throw new Error(
`Built-in Alpine cannot resolve a cache URI for ${context.originalDocumentUri}`,
`Built-in Ubuntu cannot resolve a cache URI for ${context.originalDocumentUri}`,
);
}
return {
Expand Down Expand Up @@ -133,11 +133,11 @@ export const builtinAlpineRuntimeProvider: LspRuntimeProvider = {
},

getInstallCommand(server, context, mode) {
return getAlpineInstallCommand(server, mode);
return getUbuntuInstallCommand(server, mode);
},

getUninstallCommand(server) {
return getAlpineUninstallCommand(server);
return getUbuntuUninstallCommand(server);
},

async start(server, context) {
Expand All @@ -149,10 +149,10 @@ export const builtinAlpineRuntimeProvider: LspRuntimeProvider = {
});
return {
kind: "transport",
providerId: BUILTIN_ALPINE_RUNTIME_ID,
providerId: BUILTIN_UBUNTU_RUNTIME_ID,
transport,
};
},
};

export default builtinAlpineRuntimeProvider;
export default builtinUbuntuRuntimeProvider;
4 changes: 2 additions & 2 deletions src/cm/lsp/runtimes/registerBuiltins.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { registerRuntimeProvider } from "../runtimeProviders";
import builtinAlpineRuntimeProvider from "./builtinAlpine";
import builtinUbuntuRuntimeProvider from "./builtinUbuntu";
import externalWebSocketRuntimeProvider from "./externalWebSocket";
import webWorkerRuntimeProvider from "./webWorker";

registerRuntimeProvider(builtinAlpineRuntimeProvider, { replace: true });
registerRuntimeProvider(builtinUbuntuRuntimeProvider, { replace: true });
registerRuntimeProvider(externalWebSocketRuntimeProvider, { replace: true });
registerRuntimeProvider(webWorkerRuntimeProvider, { replace: true });
26 changes: 13 additions & 13 deletions src/cm/lsp/serverLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ let cachedFilesDir: string | null = null;
/**
* Get candidate Terminal data directories from system.getFilesDir().
* Newer Terminal builds keep shared runtime state in public. Older builds used
* alpine/home, and some installs keep it as a symlink for shell compatibility.
* ubuntu/home, and some installs keep it as a symlink for shell compatibility.
*/
async function getTerminalDataDirs(): Promise<string[]> {
if (cachedFilesDir) {
return [`${cachedFilesDir}/public`, `${cachedFilesDir}/alpine/home`];
return [`${cachedFilesDir}/public`, `${cachedFilesDir}/ubuntu/home`];
}

const system = (
Expand All @@ -112,7 +112,7 @@ async function getTerminalDataDirs(): Promise<string[]> {
system.getFilesDir(
(filesDir: string) => {
cachedFilesDir = filesDir;
resolve([`${filesDir}/public`, `${filesDir}/alpine/home`]);
resolve([`${filesDir}/public`, `${filesDir}/ubuntu/home`]);
},
(error: string) => reject(new Error(error)),
);
Expand Down Expand Up @@ -336,7 +336,7 @@ function normalizeInstallSpec(server: LspServerDefinition) {
const kind =
install.kind ||
(install.binaryPath ? "manual" : null) ||
(install.source === "apk" ? "apk" : null) ||
(install.source === "apt" ? "apt" : null) ||
(install.source === "npm" ? "npm" : null) ||
(install.source === "pip" ? "pip" : null) ||
(install.source === "cargo" ? "cargo" : null) ||
Expand Down Expand Up @@ -448,9 +448,9 @@ function buildUninstallCommand(server: LspServerDefinition): string | null {
}

switch (spec.kind) {
case "apk":
case "apt":
return spec.packages.length
? `apk del ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
? `apt-get remove -y ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
: null;
case "npm": {
if (!spec.packages.length) return null;
Expand Down Expand Up @@ -489,15 +489,15 @@ function buildInstallCommand(
}

switch (spec.kind) {
case "apk":
case "apt":
return spec.packages.length
? `apk add --no-cache ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
? `apt-get install -y ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
: null;
case "npm": {
if (!spec.packages.length) return null;
const npmCommand = spec.npmCommand || "npm";
const installFlags = spec.global !== false ? "install -g" : "install";
return `apk add --no-cache nodejs npm && ${npmCommand} ${installFlags} ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`;
return `apt-get install -y nodejs npm && ${npmCommand} ${installFlags} ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`;
}
case "pip": {
if (!spec.packages.length) return null;
Expand All @@ -506,11 +506,11 @@ function buildInstallCommand(
spec.breakSystemPackages !== false
? "PIP_BREAK_SYSTEM_PACKAGES=1 "
: "";
return `apk add --no-cache python3 py3-pip && ${breakPackages}${pipCommand} install ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`;
return `apt-get install -y python3 python3-pip && ${breakPackages}${pipCommand} install ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`;
}
case "cargo":
return spec.packages.length
? `apk add --no-cache rust cargo && cargo install ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
? `apt-get install -y cargo && cargo install ${spec.packages.map((entry) => quoteArg(entry)).join(" ")}`
: null;
case "github-release": {
if (!spec.repo || !spec.binaryPath) return null;
Expand All @@ -522,10 +522,10 @@ function buildInstallCommand(
const downloadUrl = `https://github.com/${spec.repo}/releases/latest/download/$ASSET`;

if (spec.archiveType === "binary") {
return `apk add --no-cache curl && ARCH="$(uname -m)" && case "$ARCH" in\n${caseLines}\n\t*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;\nesac && TMP_DIR="$(mktemp -d)" && cleanup() { rm -rf "$TMP_DIR"; } && trap cleanup EXIT && curl -fsSL "${downloadUrl}" -o ${archivePath} && install -Dm755 ${archivePath} ${installTarget}`;
return `apt-get install -y curl && ARCH="$(uname -m)" && case "$ARCH" in\n${caseLines}\n\t*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;\nesac && TMP_DIR="$(mktemp -d)" && cleanup() { rm -rf "$TMP_DIR"; } && trap cleanup EXIT && curl -fsSL "${downloadUrl}" -o ${archivePath} && install -Dm755 ${archivePath} ${installTarget}`;
}

return `apk add --no-cache curl unzip && ARCH="$(uname -m)" && case "$ARCH" in\n${caseLines}\n\t*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;\nesac && TMP_DIR="$(mktemp -d)" && cleanup() { rm -rf "$TMP_DIR"; } && trap cleanup EXIT && curl -fsSL "${downloadUrl}" -o ${archivePath} && unzip -oq ${archivePath} -d "$TMP_DIR" && install -Dm755 "$TMP_DIR"/${extractedFile} ${installTarget}`;
return `apt-get install -y curl unzip && ARCH="$(uname -m)" && case "$ARCH" in\n${caseLines}\n\t*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;\nesac && TMP_DIR="$(mktemp -d)" && cleanup() { rm -rf "$TMP_DIR"; } && trap cleanup EXIT && curl -fsSL "${downloadUrl}" -o ${archivePath} && unzip -oq ${archivePath} -d "$TMP_DIR" && install -Dm755 "$TMP_DIR"/${extractedFile} ${installTarget}`;
}
case "manual":
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/cm/lsp/serverRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface RawBridgeConfig {
function sanitizeInstallKind(
value: unknown,
):
| "apk"
| "apt"
| "npm"
| "pip"
| "cargo"
Expand All @@ -90,7 +90,7 @@ function sanitizeInstallKind(
| "shell"
| undefined {
switch (value) {
case "apk":
case "apt":
case "npm":
case "pip":
case "cargo":
Expand Down
4 changes: 2 additions & 2 deletions src/cm/lsp/servers/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const javascriptServers: LspServerManifest[] = [
"tsx",
"jsx",
],
runtimes: ["builtin-alpine"],
runtimes: ["builtin-ubuntu"],
transport: {
kind: "websocket",
},
Expand Down Expand Up @@ -74,7 +74,7 @@ export const javascriptServers: LspServerManifest[] = [
"tsx",
"jsx",
],
runtimes: ["builtin-alpine"],
runtimes: ["builtin-ubuntu"],
transport: {
kind: "websocket",
},
Expand Down
6 changes: 3 additions & 3 deletions src/cm/lsp/servers/luau.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function isGlibcRuntimeError(output: string): boolean {

function getLuauRuntimeFailureMessage(output: string): string {
if (isGlibcRuntimeError(output)) {
return "Luau release binary requires glibc and is not runnable in this Alpine/musl environment.";
return "Luau release binary requires glibc and is not runnable in this Ubuntu/musl environment.";
}

const firstLine = String(output || "")
Expand Down Expand Up @@ -157,10 +157,10 @@ export const luauBundle: LspServerBundle = defineBundle({
}

const downloadUrl = `https://github.com/${repo}/releases/latest/download/$ASSET`;
const command = `apk add --no-cache curl unzip && ARCH="$(uname -m)" && case "$ARCH" in
const command = `apt-get install -y curl unzip && ARCH="$(uname -m)" && case "$ARCH" in
${assetCases}
\t*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac && apk add --no-cache gcompat libstdc++ && TMP_DIR="$(mktemp -d)" && cleanup() { rm -rf "$TMP_DIR"; } && trap cleanup EXIT && curl -fsSL "${downloadUrl}" -o "$TMP_DIR/$ASSET" && unzip -oq "$TMP_DIR/$ASSET" -d "$TMP_DIR" && chmod +x "$TMP_DIR/luau-lsp" && if ! "$TMP_DIR/luau-lsp" --help >/dev/null 2>&1 && ! "$TMP_DIR/luau-lsp" lsp --help >/dev/null 2>&1; then command -v ldd >/dev/null 2>&1 && ldd "$TMP_DIR/luau-lsp" >&2 || true; echo "Luau release binary is not runnable in this environment." >&2; exit 1; fi && install -Dm755 "$TMP_DIR/luau-lsp" ${quoteArg(binaryPath)}`;
esac && apt-get install -y libstdc++6 && TMP_DIR="$(mktemp -d)" && cleanup() { rm -rf "$TMP_DIR"; } && trap cleanup EXIT && curl -fsSL "${downloadUrl}" -o "$TMP_DIR/$ASSET" && unzip -oq "$TMP_DIR/$ASSET" -d "$TMP_DIR" && chmod +x "$TMP_DIR/luau-lsp" && if ! "$TMP_DIR/luau-lsp" --help >/dev/null 2>&1 && ! "$TMP_DIR/luau-lsp" lsp --help >/dev/null 2>&1; then command -v ldd >/dev/null 2>&1 && ldd "$TMP_DIR/luau-lsp" >&2 || true; echo "Luau release binary is not runnable in this environment." >&2; exit 1; fi && install -Dm755 "$TMP_DIR/luau-lsp" ${quoteArg(binaryPath)}`;

const loadingDialog = loader.create(
label,
Expand Down
12 changes: 6 additions & 6 deletions src/cm/lsp/servers/systems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const systemsServers: LspServerManifest[] = [
"--header-insertion=never",
],
checkCommand: "which clangd",
installer: installers.apk({
installer: installers.apt({
executable: "clangd",
packages: ["clang-extra-tools"],
packages: ["clangd"],
}),
enabled: false,
}),
Expand All @@ -26,9 +26,9 @@ export const systemsServers: LspServerManifest[] = [
command: "gopls",
args: ["serve"],
checkCommand: "which gopls",
installer: installers.apk({
installer: installers.apt({
executable: "gopls",
packages: ["go", "gopls"],
packages: ["golang-go", "gopls"],
}),
initializationOptions: {
usePlaceholders: false,
Expand Down Expand Up @@ -83,9 +83,9 @@ export const systemsServers: LspServerManifest[] = [
languages: ["rust"],
command: "rust-analyzer",
checkCommand: "which rust-analyzer",
installer: installers.apk({
installer: installers.apt({
executable: "rust-analyzer",
packages: ["rust", "cargo", "rust-analyzer"],
packages: ["rustc", "cargo", "rust-analyzer"],
}),
initializationOptions: {
cargo: {
Expand Down
6 changes: 3 additions & 3 deletions src/cm/lsp/servers/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const webServers: LspServerManifest[] = [
id: "html-stdio",
label: "HTML (STDIO)",
languages: ["html", "vue", "svelte"],
runtimes: ["builtin-alpine"],
runtimes: ["builtin-ubuntu"],
command: "vscode-html-language-server",
args: ["--stdio"],
checkCommand: "which vscode-html-language-server",
Expand All @@ -68,7 +68,7 @@ export const webServers: LspServerManifest[] = [
id: "css-stdio",
label: "CSS (STDIO)",
languages: ["css", "scss", "less"],
runtimes: ["builtin-alpine"],
runtimes: ["builtin-ubuntu"],
command: "vscode-css-language-server",
args: ["--stdio"],
checkCommand: "which vscode-css-language-server",
Expand All @@ -88,7 +88,7 @@ export const webServers: LspServerManifest[] = [
id: "json-stdio",
label: "JSON (STDIO)",
languages: ["json", "jsonc"],
runtimes: ["builtin-alpine"],
runtimes: ["builtin-ubuntu"],
command: "vscode-json-language-server",
args: ["--stdio"],
checkCommand: "which vscode-json-language-server",
Expand Down
Loading