Typing commit character ":" when a resource completion is selected while typing out a ternary expression will output "resource:" instead of just ":"
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
v0.15.31
**Describe the bug**
Completion item commit character `:` was assigned to resource symbols in the completion list to assist with the nested resource accessor syntax (ex. `resourceA::childResource`). This conflicts with typing out ternary expressions. https://github.com/Azure/bicep/pull/10043 will bring resource symbols to the top of the completion list for `resource.dependsOn` array item completions. This will cause a resource symbol to be preselected. When typing out a ternary expression's `:` while in that type of array, it will result in `condition ? aResource aResource:` instead of `condition ? aResource :` assuming `aResource` is the first completion that shows up.
**To Reproduce**
Steps to reproduce the behavior:
Bicep:
1. Use this bicep code in VS Code:
```
resource aResource 'Microsoft.Storage/storageAccounts@2022-09-01' = {
name: 'bar'
}
var test = false
resource foo 'Microsoft.Storage/storageAccounts@2022-09-01' = {
name: 'foo'
dependsOn: [
test ? aResource
]
}
```
2. Type `:` after "aResource " on line 8 when a resource symbol is preselected in the completion list.
Expected:
3. `:` only gets typed up after typing `:`
Actual:
3. `aResource:` gets typed out after typing `:` assuming `aResource` is the preselected completion item while typing.
**Additional context**

Contributor guide
Research direction
Reproduce the Bicep example in VS Code, focusing on resource-symbol completion and the `:` commit character while typing the ternary expression in the `dependsOn` array. Trace the completion behavior for the preselected resource item; done means typing `:` produces only the ternary colon, while nested resource accessor syntax remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100