Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.19k stars 739 forks source link

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

Open afscrome opened 3 years ago

afscrome commented 3 years ago

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

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

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

resource foo 'Microsoft.AAD/domainServices@2021-03-01' = {
  name: '''
 foo
  '''
}

image

alex-frankel commented 3 years ago

Good catch!

majastrz commented 3 years ago

I think to get correct behavior here, we will need to implement the LSP folding ranges in the language server.