diff --git a/packages/compose-language-service/bin/docker-compose-langserver b/packages/compose-language-service/bin/docker-compose-langserver old mode 100644 new mode 100755 diff --git a/packages/compose-language-service/src/test/providers/DocumentFormattingProvider.test.ts b/packages/compose-language-service/src/test/providers/DocumentFormattingProvider.test.ts index fc31fea1..6d7f2d10 100644 --- a/packages/compose-language-service/src/test/providers/DocumentFormattingProvider.test.ts +++ b/packages/compose-language-service/src/test/providers/DocumentFormattingProvider.test.ts @@ -65,6 +65,27 @@ volumes: await requestDocumentFormattingAndCompare(testConnection, uri, 2, expected2Space); }); + it('Should NOT break YAML anchors', async () => { + // See https://github.com/microsoft/vscode-containers/issues/537 + // The anchor must stay inline with its key and not be pushed onto a new line + const testObject = `version: "3.5" + +x-anchor: &anchor + FOO: bar + +services: + example: + <<: *anchor + image: alpine +`; + + const uri = testConnection.sendTextAsYamlDocument(testObject); + + const expected2Space = testObject; // Output will be unchanged, anchors must not be broken + + await requestDocumentFormattingAndCompare(testConnection, uri, 2, expected2Space); + }); + it('Should NOT wrap long string lines', async () => { const testObject = `version: '123' services: