microsoft/compose-language-service

Format Document command inserts unnecessary `null` values into the docker-compose.yml file

azuregos opened this issue · 1 comments

There is an issue when calling 'Format Document' on a Docker compose file in Docker plugin v1.18.0
When called additional null values are added to the file.

Reproduction Scenario

  1. Create docker-compose.yml file with the following content
version: "3"
services:

  service:
    image: service

networks:
  a-net:
  b-net:

volumes:
  a-data:
  b-data:
  c-data:
  d-data:
  1. In VsCode invoke a 'Format Document' command
  2. Note the added null values to the file:
version: "3"
services:

  service:
    image: service

networks:
  a-net: null
  b-net:

    null
volumes:
  a-data: null
  b-data: null
  c-data: null
  d-data: null

VsCode Version

Version: 1.62.3 (system setup)
Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Date: 2021-11-17T08:11:14.551Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042

Thanks @azuregos, I'll transfer this to the compose language service' repo.