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:
@@ -329,6 +329,30 @@ def test_detect_param_value_context_in_array():
|
||||
assert ctx["has_open_quote"] is True
|
||||
|
||||
|
||||
def test_detect_param_value_context_in_multiline_array():
|
||||
"""Cursor in multi-line array element → param_value context."""
|
||||
lines = [
|
||||
"module myMod 'br/modules:roleassignments:2.0.x' = {",
|
||||
" params: {",
|
||||
" assignments: [",
|
||||
" {",
|
||||
" roles: [",
|
||||
" 'APP_CONFIGURATION_", # ← cursor on separate line
|
||||
" ]",
|
||||
" }",
|
||||
" ]",
|
||||
" }",
|
||||
"}",
|
||||
]
|
||||
session = _make_session_with_doc(URI, lines)
|
||||
# character = len(" 'APP_CONFIGURATION_") = 27
|
||||
ctx = session._detect_context(URI, {"line": 5, "character": 27})
|
||||
assert ctx["type"] == "param_value"
|
||||
assert ctx["module"] == "roleassignments"
|
||||
assert ctx["param"] == "roles"
|
||||
assert ctx["has_open_quote"] is True
|
||||
|
||||
|
||||
def test_param_value_items_from_catalog_allowed():
|
||||
"""environmentType completions come from catalog 'allowed' field."""
|
||||
BicepModuleCatalog._modules = [_make_module(
|
||||
|
||||
Reference in New Issue
Block a user