To install, go to Releases & download the .vsix file. Then install it like any other program.
I highly recommend using this in conjunction with these instructions by ledhead900, but it's not technically a requirement.
Features
Core Script Support
- XML code completion for Visual Studio Code supporting both AI Scripts and Mission Director Scripts
- Autocompletion from scriptproperties.xml with intelligent context-aware suggestions
- Hover documentation for script properties and XSD elements
- Go to Definition and Peek Definition support for script properties
- T-file text display with hover tooltips for language references
- Support for multiple formats: {pageId,textId}, readtext.{pageId}.{textId}, and page="pageId" line="textId"
- Multi-language support with configurable preferred language
- Language filtering options for cleaner output
- Intelligent variable completion with $ trigger for both AI Scripts and Mission Director Scripts
- Variable tracking across the entire document with usage statistics
- Go to Definition, Find All References, and Symbol Rename (F2) for variables
- Hover information showing variable usage count and type
- Support for both regular variables and table key/remote variables
- Automatic variable detection in XML attributes and parameter definitions
- Label completion for AI Script elements (<resume>, <run_interrupt_script>, <abort_called_scripts>)
- Action completion for AI Script action references (<include_interrupt_actions>)
- Label and Action tracking with Go to Definition and Find All References
- Hover tooltips for labels and actions showing usage statistics
- Error diagnostics for undefined labels and actions with quick fix suggestions
- Code actions to create missing labels/actions or replace with similar existing ones
- Context-aware completion that automatically detects when you're typing variables, labels, or actions
- Smart completion triggering that prevents conflicts between different completion types
- Automatic suggestion display when typing in specialized contexts
- Real-time validation of label and action references in AI Scripts
- Quick fix suggestions for undefined references with similarity-based recommendations
- Code actions to automatically create missing definitions
- Diagnostic highlighting of undefined references
Code: Select all
| Setting | Description | Default |
| ----------------------------------- | ---------------------------------------------------- | --------------- |
| x4CodeComplete.unpackedFileLocation | Path to vanilla extracted files folder | none (required) |
| x4CodeComplete.extensionsFolder | Path to extensions folder | none (required) |
| x4CodeComplete.exceedinglyVerbose | Enable debug logging | false |
| x4CodeComplete.languageNumber | Preferred language ID for t-file display | "44" (English) |
| x4CodeComplete.limitLanguageOutput | Show only preferred language in hover text | false |
| x4CodeComplete.reloadLanguageData | Reload language files (resets to false after reload) | false |
- AI Scripts (.xml files with <aiscript> root element)
- Mission Director Scripts (.xml files with <mdscript> root element)
- All features up to version 1.4.1
- Features added in version 1.5.1
Usage Examples
Variable Completion
Code: Select all
<set_value name="$myVariable" />
<!-- Type $ to see all available variables -->
<!-- Hover over $myVariable to see usage statistics -->
Code: Select all
<label name="start" />
<!-- ... -->
<resume label="start" /> <!-- Completion available after typing " -->
Code: Select all
<library>
<actions name="myAction">
<!-- action content -->
</actions>
</library>
<!-- ... -->
<include_interrupt_actions ref="myAction" /> <!-- Completion available -->
Code: Select all
<!-- Hover over any of these to see translated text -->
<set_value name="$text" exact="{1001,100}" />
<debug_text text="readtext.{1001}.{100}" />
<speak actor="$ship" page="1001" line="100" />
- Variable scope: Currently limited to file scope (no namespace support)
- Cross-file references: Labels and actions are tracked per-file only
- Complex expressions: Advanced variable expressions in table lookups may not be fully parsed
1.0.0
Initial release. Supports scriptproperties.xml autocomplete
1.0.1
Major improvements; now has configuration & generates the entries at startup from scriptproperties.xml, removing the need for rerunning a python script when scriptproperties.xml updates.
1.0.2
Hopefully, no more duplicate suggestions. Also, Peek/Go to definition for script properties!