AXScript Language Extension for VS Code
Language support for AXScript (.axs files) - the AdaptixC2 Scripting Language.
Features
✨ Complete Language Support
- Full JavaScript IntelliSense - All JavaScript features work in .axs files
- AXScript-specific completions - 70+ custom functions from Adaptix Framework
- Syntax highlighting - Both JavaScript and AXScript syntax
- Smart autocompletion - Context-aware suggestions
- Code snippets - Pre-built templates for common patterns
📦 AXScript Functions
The extension provides autocompletion for:
ax.* - Agent management, file operations, logging, commands, etc.
form.* - UI dialog and widget creation (including containers, selectors, layouts)
menu.* - Context menu actions, submenus, and separators
event.* - Event handler registration for system events
- AxCommand methods - Enhanced command creation with full argument support
- Container methods - JSON data handling (
put, get, toJson, fromJson)
- Widget methods - Common UI element controls (
setEnabled, setVisible, etc.)
🚀 JavaScript Support
Since AXScript is a JavaScript wrapper, you get full support for:
- ES6+ features (arrow functions, async/await, destructuring)
- Built-in objects (Math, Date, Array, String, etc.)
- Modern JavaScript syntax
- TypeScript type checking (if configured)
Installation
- Install the extension from VS Code Marketplace or from VSIX file
- Restart VS Code after installation
- Open any
.axs file to activate the extension
Enable Full JavaScript IntelliSense
To get complete JavaScript autocompletion (console.log, Array methods, etc.) in .axs files, add this to your VS Code settings:
Option 1: User Settings (Recommended)
Press Ctrl+, to open settings, click the JSON icon, and add:
{
"files.associations": {
"*.axs": "javascript"
}
}
Option 2: Workspace Settings
Create .vscode/settings.json in your project root with the same content.
After adding this setting, restart VS Code. Your .axs files will have full JavaScript IntelliSense plus AXScript functions.
Usage
Getting Started
// In .axs files, you can use both JavaScript and AXScript:
// Regular JavaScript
const data = [1, 2, 3];
const doubled = data.map(x => x * 2);
// AXScript functions
ax.log("Hello from AXScript!");
const agents = ax.agents();
// Form creation
const dialog = form.create_dialog("My Dialog");
// Menu actions
const action = menu.create_action("Custom Action", function(ids) {
// Action logic
});
Autocompletion
- JavaScript autocompletion works automatically
- AXScript objects appear when you type:
ax. - Shows all ax functions
form. - Shows form functions (including containers and selectors)
menu. - Shows menu functions
event. - Shows event registration functions
- Command objects (like
cmd. or _cmd_name.) - Shows AxCommand methods
- Container objects - Shows container-specific methods
- Widget objects - Shows widget control methods
AxCommand Functions
When working with command objects created via ax.create_command(), you get completions for:
Argument Methods:
addArgString(name, required, defaultValue?) - Add string arguments
addArgInt(name, required, defaultValue?) - Add integer arguments
addArgBool(flag, description) - Add boolean flag arguments
addArgFile(name, required, description?) - Add file arguments (reads and encodes as base64)
Flag Arguments:
addArgFlagInt(flag, name, required, description?) - Add integer with flag prefix
addArgFlagString(flag, name, required, description?) - Add string with flag prefix
addArgFlagFile(flag, name, required, description?) - Add file with flag prefix
Hook Functions:
setPreHook(function) - Set pre-execution hook
setHook(function) - Set main execution hook
setPostHook(function) - Set post-execution hook
Subcommands:
addSubCommand(command) - Add a single subcommand
addSubCommands(commands[]) - Add multiple subcommands
Configuration:
setDescription(text) - Set command description
setExample(text) - Set usage example
setMessage(text) - Set execution message
Example:
let cmd = ax.create_command("example", "Example command", "example --help");
cmd.addArgString("target", true, "localhost");
cmd.addArgInt("port", false, 8080);
cmd.addArgBool("-v", "Enable verbose mode");
cmd.setPreHook(function(id, cmdline, parsed_json) {
ax.log("Validating arguments...");
});
Troubleshooting
If autocompletion is not working:
- Restart VS Code - Required after first installation
- Check file extension - Must be
.axs
- Reload Window - Use Command Palette: "Developer: Reload Window"
- Check language mode - Bottom right should show "AxScript"
Configuration
The extension automatically configures:
- Syntax highlighting
- Bracket matching
- Auto-closing pairs
- Indentation rules
- Word-based suggestions
What's New
Version 0.2.0
- Added support for AXForm type methods (containers, selectors, layouts)
- Added AXEvent type with event handler registration
- Enhanced AXMenu type with submenu and separator support
- New snippets for containers, selectors, and event handlers
- Improved IntelliSense for widget methods
- Added support for
event.on_* functions
- Container JSON data handling methods
Version 0.1.0
- Initial release with basic AXScript support
Known Issues
- JavaScript IntelliSense may require VS Code restart after installation
- Some JavaScript features may need TypeScript extension installed
Contributing
Report issues or contribute at: https://github.com/5P34R/axs-extension
License
MIT