Skip to content

Commit bbb43a7

Browse files
authored
Merge branch 'Acode-Foundation:main' into main
2 parents 8dca360 + fa02c4d commit bbb43a7

48 files changed

Lines changed: 505 additions & 257 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye
99

10-
ARG ANDROID_PLATFORM=35
11-
ARG ANDROID_BUILD_TOOLS=35.0.0
10+
ARG ANDROID_PLATFORM=36
11+
ARG ANDROID_BUILD_TOOLS=36.0.0
1212
ARG CMDLINE_TOOLS_VERSION=11076708
1313
ARG NODE_VERSION=22
1414
ARG GRADLE_VERSION=8.11
@@ -18,9 +18,13 @@ ENV ANDROID_SDK_ROOT=/opt/android-sdk
1818
ENV GRADLE_HOME=/opt/gradle
1919
ENV PATH="${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${GRADLE_HOME}/bin"
2020

21+
# removes broken yarn repo present in base image
22+
RUN rm -f /etc/apt/sources.list.d/yarn.list
23+
2124
RUN apt-get update && apt-get install -y --no-install-recommends \
2225
wget \
2326
unzip \
27+
curl \
2428
&& rm -rf /var/lib/apt/lists/*
2529

2630
# Install Gradle
@@ -30,15 +34,16 @@ RUN wget -q "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-
3034
&& ln -s /opt/gradle-${GRADLE_VERSION} ${GRADLE_HOME}
3135

3236
# Install fnm and Node.js
33-
ENV FNM_DIR=/usr/local/fnm
34-
ENV PATH="${FNM_DIR}:${PATH}"
35-
RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "${FNM_DIR}" --skip-shell \
36-
&& eval "$(${FNM_DIR}/fnm env)" \
37-
&& fnm install ${NODE_VERSION} \
38-
&& fnm default ${NODE_VERSION} \
39-
&& npm install -g pnpm
40-
41-
ENV PATH="${FNM_DIR}/aliases/default/bin:${PATH}"
37+
# Not required, mostly. When dev containers are used.
38+
# ENV FNM_DIR=/usr/local/fnm
39+
# ENV PATH="${FNM_DIR}:${PATH}"
40+
# RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "${FNM_DIR}" --skip-shell \
41+
# && eval "$(${FNM_DIR}/fnm env)" \
42+
# && fnm install ${NODE_VERSION} \
43+
# && fnm default ${NODE_VERSION} \
44+
# && npm install -g pnpm
45+
46+
# ENV PATH="${FNM_DIR}/aliases/default/bin:${PATH}"
4247

4348
# Install Android SDK
4449
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools \

.devcontainer/devcontainer.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"name": "Acode Development",
3-
"image": "mcr.microsoft.com/devcontainers/java:1-21-bullseye",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
7+
"containerEnv": {
8+
"JAVA_HOME": "/usr/local/openjdk-21"
9+
},
10+
"remoteEnv": {
11+
"JAVA_HOME": "/usr/local/openjdk-21"
12+
},
413

514
"features": {
6-
"ghcr.io/devcontainers/features/java:1": {
7-
"installGradle": true,
8-
"installGroovy": false,
9-
"installMaven": false,
10-
"installAnt": false,
11-
"version": "21",
12-
"jdkDistro": "ms",
13-
"gradleVersion": "latest"
14-
},
1515
"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {
16-
"platform": "35",
17-
"build_tools": "35.0.0"
16+
"platform": "36",
17+
"build_tools": "36.0.0"
1818
},
1919
"ghcr.io/devcontainers/features/node:1": {
2020
"nodeGypDependencies": false,
@@ -24,9 +24,9 @@
2424
"nvmVersion": "latest"
2525
}
2626
},
27-
27+
"overrideCommand": true,
2828
"postCreateCommand": "pnpm run setup",
29-
29+
"remoteUser": "root",
3030
"customizations": {
3131
"vscode": {
3232
"extensions": ["biomejs.biome", "redhat.java"],

bun.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config.xml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,17 @@
3838
<preference name="GradlePluginKotlinEnabled" value="true" />
3939
<preference name="android-targetSdkVersion" value="36" />
4040

41-
<!-- Cordova does not merge this unless both of these are present -->
42-
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
43-
<application
44-
android:usesCleartextTraffic="true"
41+
42+
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
43+
<application
4544
android:networkSecurityConfig="@xml/network_security_config"
4645
android:hardwareAccelerated="true"
4746
android:largeHeap="true"
4847
android:requestLegacyExternalStorage="true"
48+
android:usesCleartextTraffic="true"
4949
android:enableOnBackInvokedCallback="false" />
5050
</edit-config>
5151

52-
<!-- Cordova does not merge this unless both of these are present -->
53-
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
54-
<application android:networkSecurityConfig="@xml/network_security_config" />
55-
<application android:usesCleartextTraffic="true" />
56-
<application android:hardwareAccelerated="true" />
57-
<application android:largeHeap="true" />
58-
<application android:requestLegacyExternalStorage="true"/>
59-
<application android:enableOnBackInvokedCallback="false" />
60-
</edit-config>
61-
6252
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
6353
<activity android:resizeableActivity="true" />
6454
</edit-config>
@@ -69,7 +59,8 @@
6959
<action android:name="android.intent.action.EDIT" />
7060
<category android:name="android.intent.category.DEFAULT" />
7161
<category android:name="android.intent.category.LAUNCHER" />
72-
<data android:mimeType="*/*"/>
62+
<data android:scheme="file" android:mimeType="*/*" />
63+
<data android:scheme="content" android:mimeType="*/*" />
7364
</intent-filter>
7465
<!-- Allow app to open using url from browser -->
7566
<intent-filter android:autoVerify="true">
@@ -92,4 +83,4 @@
9283
<hook type="after_prepare" src="hooks/post-process.js" />
9384
</platform>
9485
<preference name="AndroidBlacklistSecureSocketProtocols" value="SSLv3,TLSv1" />
95-
</widget>
86+
</widget>

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cm/commandRegistry.js

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,31 @@ function registerCoreCommands() {
503503
return true;
504504
},
505505
});
506+
addCommand({
507+
name: "increaseUiZoom",
508+
description: "Increase UI zoom",
509+
readOnly: true,
510+
requiresView: false,
511+
run: () => adjustUiZoom(10),
512+
});
513+
addCommand({
514+
name: "decreaseUiZoom",
515+
description: "Decrease UI zoom",
516+
readOnly: true,
517+
requiresView: false,
518+
run: () => adjustUiZoom(-10),
519+
});
506520
addCommand({
507521
name: "increaseFontSize",
508-
description: "Increase font size",
509-
readOnly: false,
522+
description: "Increase editor font size",
523+
readOnly: true,
510524
requiresView: false,
511525
run: () => adjustFontSize(1),
512526
});
513527
addCommand({
514528
name: "decreaseFontSize",
515-
description: "Decrease font size",
516-
readOnly: false,
529+
description: "Decrease editor font size",
530+
readOnly: true,
517531
requiresView: false,
518532
run: () => adjustFontSize(-1),
519533
});
@@ -1307,12 +1321,20 @@ async function openInAppBrowserCommand() {
13071321
function adjustFontSize(delta) {
13081322
const current = settings?.value?.fontSize || "12px";
13091323
const numeric = Number.parseInt(current, 10) || 12;
1310-
const next = Math.max(1, numeric + delta);
1324+
const next = Math.min(72, Math.max(6, numeric + delta));
13111325
settings.value.fontSize = `${next}px`;
13121326
settings.update(false);
13131327
return true;
13141328
}
13151329

1330+
function adjustUiZoom(delta) {
1331+
const current = Number(settings?.value?.uiZoom) || 100;
1332+
const next = Math.min(160, Math.max(70, current + delta));
1333+
settings.value.uiZoom = next;
1334+
settings.update(false);
1335+
return true;
1336+
}
1337+
13161338
function parseKeyString(keyString) {
13171339
if (!keyString) return [];
13181340
return String(keyString)
@@ -1356,10 +1378,12 @@ function buildResolvedKeyBindingsSnapshot() {
13561378

13571379
function toCodeMirrorKey(combo) {
13581380
if (!combo) return null;
1359-
const parts = combo
1360-
.split("-")
1361-
.map((part) => part.trim())
1362-
.filter(Boolean);
1381+
const parts = combo.endsWith("-")
1382+
? [...combo.slice(0, -1).split("-").filter(Boolean), "-"]
1383+
: combo
1384+
.split("-")
1385+
.map((part) => part.trim())
1386+
.filter(Boolean);
13631387
const modifiers = [];
13641388
let key = null;
13651389

src/cm/lsp/serverLauncher.ts

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ export { formatCommand } from "./installRuntime";
7777
let cachedFilesDir: string | null = null;
7878

7979
/**
80-
* Get the terminal home directory from system.getFilesDir().
81-
* This is where axs stores port files.
80+
* Get candidate Terminal data directories from system.getFilesDir().
81+
* Newer Terminal builds keep shared runtime state in public. Older builds used
82+
* alpine/home, and some installs keep it as a symlink for shell compatibility.
8283
*/
83-
async function getTerminalHomeDir(): Promise<string> {
84+
async function getTerminalDataDirs(): Promise<string[]> {
8485
if (cachedFilesDir) {
85-
return `${cachedFilesDir}/alpine/home`;
86+
return [`${cachedFilesDir}/public`, `${cachedFilesDir}/alpine/home`];
8687
}
8788

8889
const system = (
@@ -104,7 +105,7 @@ async function getTerminalHomeDir(): Promise<string> {
104105
system.getFilesDir(
105106
(filesDir: string) => {
106107
cachedFilesDir = filesDir;
107-
resolve(`${filesDir}/alpine/home`);
108+
resolve([`${filesDir}/public`, `${filesDir}/alpine/home`]);
108109
},
109110
(error: string) => reject(new Error(error)),
110111
);
@@ -115,14 +116,16 @@ async function getTerminalHomeDir(): Promise<string> {
115116
* Get the port file path for a given server and session.
116117
* Port file format: ~/.axs/lsp_ports/{serverName}_{session}
117118
*/
118-
async function getPortFilePath(
119+
async function getPortFilePaths(
119120
serverName: string,
120121
session: string,
121-
): Promise<string> {
122-
const homeDir = await getTerminalHomeDir();
122+
): Promise<string[]> {
123+
const dataDirs = await getTerminalDataDirs();
123124
// Use just the binary name (not full path), mirroring axs behavior
124125
const baseName = serverName.split("/").pop() || serverName;
125-
return `file://${homeDir}/.axs/lsp_ports/${baseName}_${session}`;
126+
return dataDirs.map(
127+
(dataDir) => `file://${dataDir}/.axs/lsp_ports/${baseName}_${session}`,
128+
);
126129
}
127130

128131
/**
@@ -166,14 +169,16 @@ export async function getLspPort(
166169
session: string,
167170
): Promise<PortInfo | null> {
168171
try {
169-
const filePath = await getPortFilePath(serverName, session);
170-
const port = await readPortFromFile(filePath);
172+
const filePaths = await getPortFilePaths(serverName, session);
171173

172-
if (port === null) {
173-
return null;
174+
for (const filePath of filePaths) {
175+
const port = await readPortFromFile(filePath);
176+
if (port !== null) {
177+
return { port, filePath, session };
178+
}
174179
}
175180

176-
return { port, filePath, session };
181+
return null;
177182
} catch {
178183
return null;
179184
}
@@ -1094,6 +1099,18 @@ export async function ensureServerRunning(
10941099
const key = server.id;
10951100
if (managedServers.has(key)) {
10961101
const existing = managedServers.get(key);
1102+
if (bridge && !bridge.port) {
1103+
if (existing?.port) {
1104+
return { uuid: existing.uuid, discoveredPort: existing.port };
1105+
}
1106+
const portInfo = await getLspPort(serverName, effectiveSession);
1107+
if (portInfo) {
1108+
if (existing) {
1109+
existing.port = portInfo.port;
1110+
}
1111+
return { uuid: existing?.uuid ?? null, discoveredPort: portInfo.port };
1112+
}
1113+
}
10971114
return { uuid: existing?.uuid ?? null };
10981115
}
10991116

@@ -1126,6 +1143,11 @@ export async function ensureServerRunning(
11261143
entry.port = discoveredPort;
11271144
}
11281145
}
1146+
if (!discoveredPort) {
1147+
throw new Error(
1148+
`Could not discover websocket bridge port for ${server.id}`,
1149+
);
1150+
}
11291151
} else if (
11301152
server.transport?.url &&
11311153
(server.transport.kind === "websocket" ||

0 commit comments

Comments
 (0)