fix(bicep): support multi-line array completion for roles and other enums
Adds support for autocomplete in multi-line array syntax like:
roles: [
'KEY_VAULT_ ← cursor triggers completion here
]
Previously only worked on same line as opening bracket:
roles: ['KEY_VAULT_ ← only this worked
Changes:
- Walk backwards up to 10 lines to find array opening (e.g. "roles: [")
- Detect if cursor is inside array based on indentation and quotes
- Stop lookback if closing bracket found (not in array anymore)
- Add test case for nested multi-line array completion
- Improve lsp_bridge.py error handling with traceback logging
- Add lsp_bridge_debug.sh wrapper for easier IntelliJ debugging
- Update EDITOR_SETUP.md with correct IntelliJ LSP4IJ config
Fixes autocomplete for deeply nested structures like:
assignments: [{ roles: ['APP_CONFIGURATION_...'] }]
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -154,6 +154,31 @@ class _ProxySession:
|
||||
"has_open_quote": bool(array_m.group(2)),
|
||||
}
|
||||
|
||||
# Check if cursor is inside a multi-line array element
|
||||
# e.g. " 'APP_CONFIG" on line after "roles: ["
|
||||
# Walk backwards to find the array opening
|
||||
for lookback_idx in range(line_idx - 1, max(0, line_idx - 10), -1):
|
||||
prev_line = lines[lookback_idx]
|
||||
# Found array opening like "roles: [" or " roles: ["
|
||||
array_open_m = re.match(r"^\s*(\w+):\s*\[$", prev_line.rstrip())
|
||||
if array_open_m:
|
||||
param_name = array_open_m.group(1)
|
||||
if param_name not in {"params", "name", "module", "resource"}:
|
||||
# Check if current line is inside the array (has quote or is indented)
|
||||
if re.match(r"^\s+('?)([^',\]]*)\s*$", current):
|
||||
has_quote = bool(re.match(r"^\s+'", current))
|
||||
return {
|
||||
"type": "param_value",
|
||||
"module": mod_name,
|
||||
"version": mod_ver,
|
||||
"param": param_name,
|
||||
"has_open_quote": has_quote,
|
||||
}
|
||||
break
|
||||
# Stop if we hit a closing bracket (we're outside the array)
|
||||
if "]" in prev_line:
|
||||
break
|
||||
|
||||
return {
|
||||
"type": "param",
|
||||
"module": mod_name,
|
||||
|
||||
Reference in New Issue
Block a user