Anode Debug for Visual Studio Code
Debug anode automation scripts running on Android devices directly from Visual Studio Code.
Features
- Debug JavaScript Scripts: Set breakpoints, step through code, and inspect variables in anode scripts running on Android devices
- Device Discovery: Automatically discover anode-enabled devices via USB (ADB) and WiFi (mDNS)
- Multiple Connection Types: Connect via USB or WiFi
- Real-time Console: View script output and logs in real-time
- Source Mapping: Support for source maps with configurable path overrides
- Variable Inspection: Examine variables, objects, and call stacks during debugging
- Hot Reload: Sync code changes to device without restarting
Requirements
- VSCode: Version 1.74.0 or higher
- Android Device/Emulator: Running anode app with debug server enabled
- ADB: Android Debug Bridge installed and accessible in PATH (for USB connections)
- Node.js: Version 14 or higher (for development)
Quick Start
1. Install the Extension
Install from VSCode Marketplace or build from source:
npm install
npm run compile
2. Connect Your Device
USB Connection:
- Enable USB debugging on your Android device
- Connect device via USB
- Authorize the computer when prompted
WiFi Connection:
- Ensure device and computer are on the same network
- Enable debug server in anode app settings
- Extension will auto-discover devices via mDNS
Create a .vscode/launch.json in your project:
{
"version": "0.2.0",
"configurations": [
{
"type": "anode",
"request": "launch",
"name": "Debug Anode Script",
"script": "${file}",
"projectPath": "${workspaceFolder}",
"stopOnEntry": false
}
]
}
4. Start Debugging
- Open a JavaScript file
- Set breakpoints by clicking in the gutter
- Press F5 or click "Start Debugging"
- Select your device when prompted
Configuration
Extension Settings
Configure in VSCode settings (File > Preferences > Settings):
anode.debug.port: Debug server port (default: 9229)
anode.debug.timeout: Connection timeout in ms (default: 10000)
anode.debug.maxRetries: Maximum connection retry attempts (default: 3)
anode.adb.path: Path to ADB executable (default: "adb")
anode.debug.verbose: Enable verbose logging (default: false)
Launch Configuration Options
Launch Request:
{
"type": "anode",
"request": "launch",
"name": "Debug Current Script",
"projectPath": "${workspaceFolder}",
"script": "${file}",
"device": "auto",
"connectionType": "auto",
"port": 9229,
"stopOnEntry": false,
"timeout": 10000,
"sourceMaps": true,
"sourceMapPathOverrides": {
"/storage/emulated/0/anode/projects/*": "${workspaceFolder}/*"
},
"scriptArgs": [],
"env": {},
"auth": {
"token": "${env:ANODE_DEBUG_TOKEN}"
}
}
Attach Request:
{
"type": "anode",
"request": "attach",
"name": "Attach to Process",
"device": "auto",
"processId": 0,
"projectPath": "${workspaceFolder}",
"port": 9229
}
Commands
- Anode: Start Debugging (
anode.debug.start) - Start debugging current file
- Anode: Select Device (
anode.selectDevice) - Choose target device
- Anode: Sync Project (
anode.syncProject) - Sync project files to device
- Anode: Show Device Logs (
anode.showDeviceLogs) - View device logs
- Anode: Generate Debug Token (
anode.generateToken) - Generate authentication token
Troubleshooting
Device Not Found
USB Connection:
- Verify ADB is installed:
adb version
- Check device is connected:
adb devices
- Ensure USB debugging is enabled on device
WiFi Connection:
- Verify device and computer are on same network
- Check anode debug server is running in app settings
- Verify port 9229 is not blocked by firewall
Connection Timeout
- Increase timeout in settings:
anode.debug.timeout
- Check anode app is running on device
- Verify debug server is enabled in anode settings
Breakpoints Not Working
- Ensure source maps are enabled
- Verify
sourceMapPathOverrides matches your project structure
- Check script is actually being executed on device
Development
Building from Source
# Clone repository
git clone https://github.com/yunxi/vscode-anode-debug.git
cd vscode-anode-debug
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
Debugging the Extension
- Open project in VSCode
- Press F5 to launch Extension Development Host
- Set breakpoints in extension code
- Test with sample anode scripts
Known Issues
- Source mapping requires exact path configuration
- WiFi discovery may take several seconds
- Some devices may require manual IP configuration
Release Notes
1.0.0
Initial release:
- Basic debugging support (breakpoints, stepping, variables)
- USB and WiFi device discovery
- Source mapping support
- Real-time console output
- Device selection UI
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
License
MIT License - see LICENSE file for details
Links
Support
For questions and support: