Azure / Azure/bicep

VS Code folding gets confused if multi line string is not indented

Open
#2,474 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
VS Code 0.3.255

**Describe the bug**
Foldi

**To Reproduce**

Open the following up in VS Code, then attempt to fold the resource block

```bicep
resource foo 'Microsoft.AAD/domainServices@2021-03-01' = {
name: '''
foo
'''
}
```
Rather than collapse the whole resource, it only gets partially collapsed (up until the multi line string)

![image](https://user-images.githubusercontent.com/289860/116612258-41f40400-a92f-11eb-81e4-96682328682a.png)

**Additional context**

The problem seems to be caused by the contents of the multi line string not being indented. If you indent the `foo` line by just a single space (like below), then the folding behaves correctly

```bicep
resource foo 'Microsoft.AAD/domainServices@2021-03-01' = {
name: '''
foo
'''
}
```
![image](https://user-images.githubusercontent.com/289860/116612712-c8104a80-a92f-11eb-91e4-98ce60f535b0.png)

Contributor guide

Open the contributing guide

Research direction

Start by opening the provided Bicep resource in VS Code and reproducing folding with the multiline string contents unindented, then compare it with the indented example. Trace the folding behavior responsible for resource blocks and verify that folding collapses the entire resource in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.