BAD_INDENT false positive if alias is used as mapping key in Docker Compose file
i-ky opened this issue · 4 comments
i-ky commented
When alias is used as a key in services:
mapping, e.g.
version: "3.8"
x-service:
- &foo_service foo
services:
*foo_service:
image: alpine
bar:
image: busybox
depends_on:
- *foo_service
...extension reports Problems:
[{
"resource": "/C:/Users/i-ky/docker-compose.yml",
"owner": "_generated_diagnostic_collection_name_#1",
"code": "BAD_INDENT",
"severity": 8,
"message": "All mapping items must start at the same column",
"startLineNumber": 8,
"startColumn": 1,
"endLineNumber": 8,
"endColumn": 2
},{
"resource": "/C:/Users/i-ky/docker-compose.yml",
"owner": "_generated_diagnostic_collection_name_#1",
"code": "BAD_INDENT",
"severity": 8,
"message": "All mapping items must start at the same column",
"startLineNumber": 9,
"startColumn": 1,
"endLineNumber": 9,
"endColumn": 2
}]
The config file is actually fine and no diagnostics should be emitted:
PS C:\Users\i-ky> docker-compose config
services:
bar:
depends_on:
foo:
condition: service_started
image: busybox
foo:
image: alpine
version: '3.8'
Extension version: 1.19.0
VS Code version: 1.63.2
bwateratmsft commented
Thanks @i-ky! I'll transfer this to the compose-language-service repo.
bwateratmsft commented
It looks like it could be a parsing issue in the yaml
library we are using. I opened eemeli/yaml#350.
i-ky commented
Thanks to eemeli/yaml#350 (comment) I noticed that indeed :
is highlighted as part of the alias name (as it should be according to latest YAML specification). Adding a space before it for disambiguation makes everyone happy.
bwateratmsft commented
I guess since this is external and there's a workaround I'll close this issue now.