Skip to content

QuickFix for "flow sequence forbidden" leaves in trailing ] #1060

@datho7561

Description

@datho7561

Describe the bug

Given the following YAML:

food: ['apple','bread','croutons','dandriff','escargot','fettucine','gastronomy handbook']

And the following in in settings.json:

{
// ...
  "yaml.style.flowSequence": "forbid"
// ...
}

An error is generated, because flow sequences aren't allowed. If you attempt to apply the quickfix code action to fix the problem, it results in invalid YAML, because the trailing ] is left in.

Note that this only happens when the flow sequence is at the very end of the document, which messes up the error range as well.

Expected Behavior

food:
  - 'apple'
  - 'bread'
  - 'croutons'
  - 'dandriff'
  - 'escargot'
  - 'fettucine'
  - 'gastronomy handbook'

Current Behavior

food:
  - 'apple'
  - 'bread'
  - 'croutons'
  - 'dandriff'
  - 'escargot'
  - 'fettucine'
  - 'gastronomy handbook']

Steps to Reproduce

  1. Make the above
  2. Use settings.json to forbid flow sequences
  3. Apply the code action to turn the flow sequence into a normal YAML list

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions