Skip to content
Open
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
21 changes: 13 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"editor.formatOnSave": true,
"autoimport.doubleQuotes": false,
"java.configuration.updateBuildConfiguration": "disabled",
"prettier.requireConfig": true,
"javascript.format.enable": true,
"js/ts.format.enabled": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.tabWidth": 2,
"prettier.useTabs": false,
"javascript.format.semicolons": "insert",
"js/ts.format.semicolons": "insert",
"[scss]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
Expand All @@ -27,6 +25,13 @@
"attr_quotes": "single"
}
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickFix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"cSpell.words": [
"abap",
"Acode",
Expand Down Expand Up @@ -126,6 +131,7 @@
"flac",
"Flix",
"floobits",
"FOXBIZ",
"Foxdebug",
"freemarker",
"gamemaker",
Expand Down Expand Up @@ -370,10 +376,9 @@
"wtest",
"wxml",
"wxss",
"xhrs",
"XMLHTTP",
"xquery",
"Zeek"
],
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
}
]
}
21 changes: 9 additions & 12 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,15 @@
},
"files": {
"includes": [
"**/src/**/*",
"**/utils/**/*.js",
"!**/www/build/**/*",
"**/www/res/**/*.css",
"**/src/plugins/terminal/**",
"!**/ace-builds",
"!**/src/plugins/**/*",
"!**/plugins/**/*",
"!**/hooks/**/*",
"!**/fastlane/**/*",
"!**/res/**/*",
"!**/platforms/**/*"
"src/**/*.js",
"utils/**/*.js",
"!src/lang/**/*.json",
"!src/plugins/**/*.js",
"!www/**/*",
"!plugins/**/*",
"!hooks/**/*",
"!fastlane/**/*",
"!platforms/**/*"
]
}
}
3 changes: 0 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 33 additions & 4 deletions hooks/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ enableStaticContext();
patchTargetSdkVersion();
enableKeyboardWorkaround();

function getPackageName() {
const configPath = path.resolve(__dirname, '../config.xml');
if (!fs.existsSync(configPath)) {
console.warn('[Cordova Hook] ⚠️ config.xml not found at', configPath);
throw new Error(`config.xml is missing at ${configPath}`);
}
const content = fs.readFileSync(configPath, 'utf-8');
const match = content.match(/id="([^"]+)"/);
const packageName = match ? match[1] : 'com.foxdebug.acode';
return packageName;
}


function getTmpDir() {
const tmpdirEnv = process.env.TMPDIR;
Expand Down Expand Up @@ -107,11 +119,17 @@ function enableLegacyJni() {
const prefix = execSync('npm prefix').toString().trim();
const gradleFile = path.join(prefix, 'platforms/android/app/build.gradle');

if (!fs.existsSync(gradleFile)) return;
if (!fs.existsSync(gradleFile)){
console.warn('[Cordova Hook] ⚠️ build.gradle not found');
return
};

let content = fs.readFileSync(gradleFile, 'utf-8');
// Check for correct block to avoid duplicate insertion
if (content.includes('useLegacyPackaging = true')) return;
if (content.includes('useLegacyPackaging = true')){
console.log('[Cordova Hook] ✅ Legacy JNI packaging already enabled, skipping');
return
};

// Inject under android block with correct Groovy syntax
content = content.replace(/android\s*{/, match => {
Expand All @@ -133,12 +151,16 @@ function enableLegacyJni() {
function enableStaticContext() {
try {
const prefix = execSync('npm prefix').toString().trim();
const packageName = getPackageName();
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java/com/foxdebug/acode/MainActivity.java'
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
'MainActivity.java'
);

if (!fs.existsSync(mainActivityPath)) {
console.warn('[Cordova Hook] ⚠️ MainActivity.java not found at', mainActivityPath);
return;
}

Expand All @@ -150,6 +172,7 @@ function enableStaticContext() {
content.includes('public static Context getContext()') &&
content.includes('weakContext = new WeakReference<>(this);')
) {
console.log('[Cordova Hook] ✅ Static context already enabled, skipping');
return;
}

Expand Down Expand Up @@ -181,6 +204,7 @@ function enableStaticContext() {
);

fs.writeFileSync(mainActivityPath, content, 'utf-8');
console.log('[Cordova Hook] ✅ Enabled static context');
} catch (err) {
console.error('[Cordova Hook] ❌ Failed to patch MainActivity:', err.message);
}
Expand All @@ -189,19 +213,24 @@ function enableStaticContext() {
function enableKeyboardWorkaround() {
try{
const prefix = execSync('npm prefix').toString().trim();
const packageName = getPackageName();
const mainActivityPath = path.join(
prefix,
'platforms/android/app/src/main/java/com/foxdebug/acode/MainActivity.java'
'platforms/android/app/src/main/java',
packageName.replace(/\./g, '/'),
'MainActivity.java'
);

if (!fs.existsSync(mainActivityPath)) {
console.warn('[Cordova Hook] ⚠️ MainActivity.java not found at', mainActivityPath);
return;
}

let content = fs.readFileSync(mainActivityPath, 'utf-8');

// Skip if already patched
if (content.includes('SoftInputAssist')) {
console.log('[Cordova Hook] ✅ Keyboard workaround already enabled, skipping');
return;
}

Expand Down
3 changes: 1 addition & 2 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"exclude": ["**/node_modules", "**/platforms", "**/www", "www/js/ace/**/*"],
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"*": ["*"]
"*": ["./src/*"]
}
},
"include": ["src/**/*"],
Expand Down
7 changes: 0 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"com.foxdebug.acode.rk.exec.terminal": {},
"com.foxdebug.acode.rk.customtabs": {},
"com.foxdebug.acode.rk.plugin.plugincontext": {},
"com.foxdebug.acode.rk.auth": {},
"cordova-plugin-system": {}
"cordova-plugin-system": {},
"com.foxdebug.acode.rk.auth": {}
},
"platforms": [
"android"
Expand Down Expand Up @@ -137,7 +137,6 @@
"@codemirror/state": "^6.6.0",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.40.0",
"@deadlyjack/ajax": "^1.2.6",
"@emmetio/codemirror6-plugin": "^0.4.0",
"@lezer/highlight": "^1.2.3",
"@ungap/custom-elements": "^1.3.0",
Expand Down
11 changes: 10 additions & 1 deletion src/cm/lsp/serverLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const STATUS_FAILED: InstallStatus = "failed";

const AXS_BINARY = "$PREFIX/axs";

let alreadyInformed = false;

function getTerminalRequiredMessage(): string {
return (
strings?.terminal_required_message_for_lsp ??
Expand Down Expand Up @@ -1081,7 +1083,14 @@ export async function ensureServerRunning(
} catch {}
if (!isTerminalInstalled) {
const message = getTerminalRequiredMessage();
alert(strings?.error, message);

if (!alreadyInformed){
alreadyInformed = true;
alert(strings?.error, message);
}else{
toast(message);
}

const unavailable: LspError = new Error(message);
unavailable.code = "LSP_SERVER_UNAVAILABLE";
throw unavailable;
Expand Down
Loading