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:
@@ -14,21 +14,49 @@ supports LSP WebSocket transport.
|
||||
|
||||
## IntelliJ IDEA setup (LSP4IJ)
|
||||
|
||||
Install the [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij) plugin, then:
|
||||
Install the [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij) plugin, then add language servers:
|
||||
|
||||
### Bicep
|
||||
|
||||
1. **Settings → Languages & Frameworks → LSP → Language Servers → +**
|
||||
- Name: `iLSP Bicep`
|
||||
- Server type: `Command` (not WebSocket — see note below)
|
||||
- Command: `python3`
|
||||
- Arguments: `/Users/lrihni/Projects/iLSP/scripts/lsp_bridge.py wss://ilsp.i80.dk/bicep`
|
||||
- Command: `/Users/lrihni/Projects/iLSP/scripts/lsp_bridge_debug.sh wss://ilsp.i80.dk/bicep`
|
||||
- Arguments: (leave blank)
|
||||
- File pattern: `*.bicep;*.bicepparam`
|
||||
|
||||
### YAML (Azure DevOps + GitHub Actions)
|
||||
|
||||
2. **Settings → Languages & Frameworks → LSP → Language Servers → +**
|
||||
- Name: `iLSP YAML`
|
||||
- Server type: `Command`
|
||||
- Command: `/Users/lrihni/Projects/iLSP/scripts/lsp_bridge_debug.sh wss://ilsp.i80.dk/yaml`
|
||||
- Arguments: (leave blank)
|
||||
- File pattern: `*.yaml;*.yml;azure-pipelines.yml`
|
||||
|
||||
### Python (optional)
|
||||
|
||||
3. **Settings → Languages & Frameworks → LSP → Language Servers → +**
|
||||
- Name: `iLSP Python`
|
||||
- Server type: `Command`
|
||||
- Command: `/Users/lrihni/Projects/iLSP/scripts/lsp_bridge_debug.sh wss://ilsp.i80.dk/python`
|
||||
- Arguments: (leave blank)
|
||||
- File pattern: `*.py`
|
||||
|
||||
> **Note**: LSP4IJ's WebSocket mode doesn't handle LSP Content-Length framing correctly,
|
||||
> causing "starting..." to hang or "Stream closed" errors. Use `lsp_bridge.py` instead.
|
||||
> causing "starting..." to hang or "Stream closed" errors. Use `lsp_bridge_debug.sh` wrapper
|
||||
> which calls `lsp_bridge.py` and logs errors to `/tmp/lsp_bridge_debug.log` for debugging.
|
||||
|
||||
2. **Add a file-type mapping** under the new server entry:
|
||||
- File pattern: `*.bicep;*.bicepparam` (include both Bicep file types)
|
||||
### Troubleshooting
|
||||
|
||||
3. **Disable Azure Toolkit Bicep completions** — this is critical if you have the
|
||||
If the language server doesn't start, check the debug log:
|
||||
```bash
|
||||
tail -f /tmp/lsp_bridge_debug.log
|
||||
```
|
||||
|
||||
### Disable conflicting plugins
|
||||
|
||||
**Disable Azure Toolkit Bicep completions** — this is critical if you have the
|
||||
Azure Toolkit plugin installed. Without this step, IDEA merges completions from
|
||||
both LSP4IJ and Azure Toolkit, resulting in noisy suggestions (`resource`,
|
||||
`projectName`, Bicep schema types, etc.) appearing alongside iLSP results.
|
||||
|
||||
Reference in New Issue
Block a user