This document describes the Map variable intelligence features in the AutoIt-VSCode extension.
AutoIt Maps are associative arrays that use key-value pairs. This extension provides intelligent IntelliSense for Map keys based on static analysis of your code.
When you type $mapVariable., the extension analyzes your code to suggest available keys.
Example:
Local $mUser[]
$mUser.name = "John"
$mUser.email = "john@example.com"
; Type: $mUser.
; Suggestions: name, emailThe extension respects variable scoping rules and provides suggestions based on the closest declaration.
Example:
Global $mConfig[]
$mConfig.apiKey = "global-key"
Func DoWork()
Local $mConfig[] ; Shadows global
$mConfig.tempData = "local-data"
; Type: $mConfig.
; Suggestions: tempData (only local scope)
EndFuncThe extension follows #include directives to merge Map definitions from multiple files.
Example:
config.au3:
Global $mApp[]
$mApp.name = "MyApp"
$mApp.version = "1.0"main.au3:
#include "config.au3"
$mApp.debugMode = True
; Type: $mApp.
; Suggestions: name, version, debugModeKeys added to Map parameters within functions are tracked and suggested with lower priority.
Example:
Func AddUserData($userMap)
$userMap.name = "Default"
$userMap.id = 0
EndFunc
Local $mUser[]
AddUserData($mUser)
; Type: $mUser.
; Suggestions: name, id (marked as "added in function")Type: boolean
Default: true
Enable or disable Map key completions.
Type: number
Default: 3
Maximum depth for resolving #include files. Higher values allow deeper include chains but may impact performance.
Type: boolean
Default: true
Show keys that are added when Maps are passed to function parameters. These are marked with lower confidence.
When tuning these settings, consider the trade-offs between feature completeness and editor performance:
• includeDepth: For large repositories or remote workspaces (WSL, SSH), reduce to 1–2 to improve responsiveness by limiting parsed files during include resolution.
• enableIntelligence: In very large projects or CI environments where IntelliSense isn't critical, consider disabling to minimize resource usage.
• showFunctionKeys: Keep enabled for more accurate completions, but can be disabled if you prefer fewer low-confidence suggestions.
• Monitoring: Watch editor memory usage and response time, then adjust settings iteratively based on your workspace characteristics.
What works well for a small local project may need tuning for large multi-file codebases.
The extension uses static analysis to:
- Parse Map declarations: Detect
Local/Global/Dim/Static $var[]patterns - Track key assignments: Find
$map.key = valueand$map["key"] = valuepatterns - Analyze function boundaries: Determine scope and track function parameters
- Resolve includes: Follow
#includedirectives to merge definitions - Provide completions: Suggest keys based on scope and position
- Single-level Maps only: AutoIt Maps do not support nested/chained key access. Syntax like
$map["key1"]["key2"]or$map.key1.key2is invalid in AutoIt. Use single keys with descriptive names instead:$map["user_name"]or$map.userName. Note: Keys CAN contain dots as literal characters -$map["database.host"]is a valid SINGLE key, not nested access. - Static analysis: Only detects keys assigned via direct syntax, not dynamic keys
- Function tracking: Limited to same-file functions initially
- Performance: Very large workspaces may experience delays (see configuration)
- Cross-file function parameter tracking
- Dynamic key detection from MapAppend calls
- Map type inference and validation
No completions appearing:
- Check
autoit.maps.enableIntelligenceistrue - Ensure Map is declared with
[]syntax:Local $mVar[] - Verify file is recognized as AutoIt (check language mode)
Missing keys from included files:
- Check
autoit.maps.includeDepthsetting - Verify include paths are correct
- Check
autoit.includePathssetting for library includes
Performance issues:
- Reduce
autoit.maps.includeDepth - Disable
autoit.maps.showFunctionKeysif not needed