From 4dcc2e6e288ded3aeea59bddb36e0b19d2c4a687 Mon Sep 17 00:00:00 2001 From: Laxman Reddy Aileni Date: Wed, 15 Jul 2026 17:29:23 +0000 Subject: [PATCH] fix: support inline completions in Docker Compose files Some IDEs (e.g. VS Code) report docker-compose files with the 'dockercompose' language id rather than 'yaml'. The server language detection did not map 'dockercompose', so it only resolved these files via the .yaml/.yml extension fallback and treated the language id as unsupported. Map 'dockercompose' to 'yaml' so completions are provided for docker-compose files regardless of how the client reports them. Adds unit tests covering the language-id mapping and supported-language resolution. --- .../src/shared/languageDetection.test.ts | 12 ++++++++++++ .../src/shared/languageDetection.ts | 3 +++ 2 files changed, 15 insertions(+) diff --git a/server/aws-lsp-codewhisperer/src/shared/languageDetection.test.ts b/server/aws-lsp-codewhisperer/src/shared/languageDetection.test.ts index c8a1193677..64cd8f50b4 100644 --- a/server/aws-lsp-codewhisperer/src/shared/languageDetection.test.ts +++ b/server/aws-lsp-codewhisperer/src/shared/languageDetection.test.ts @@ -33,6 +33,13 @@ describe('LanguageDetection', () => { ) } }) + + it(`maps the 'dockercompose' language id (used by some IDEs for docker-compose files) to yaml`, () => { + assert.strictEqual( + getLanguageId(TextDocument.create('test://docker-compose.yaml', 'dockercompose', 1, '')), + 'yaml' + ) + }) }) describe('getSupportedLanguageId', () => { @@ -41,6 +48,11 @@ describe('LanguageDetection', () => { assert.ok(getSupportedLanguageId(typescriptDocument, ['typescript', 'javascript'])) assert.ok(!getSupportedLanguageId(typescriptDocument, ['javascript'])) }) + + it('should support docker-compose files reported with the dockercompose language id', () => { + const dockerComposeDocument = TextDocument.create('test://docker-compose.yaml', 'dockercompose', 1, '') + assert.strictEqual(getSupportedLanguageId(dockerComposeDocument), 'yaml') + }) }) describe('getCodeWhispererLanguageIdFromPath', () => { diff --git a/server/aws-lsp-codewhisperer/src/shared/languageDetection.ts b/server/aws-lsp-codewhisperer/src/shared/languageDetection.ts index ab3761528b..55a2b48ca4 100644 --- a/server/aws-lsp-codewhisperer/src/shared/languageDetection.ts +++ b/server/aws-lsp-codewhisperer/src/shared/languageDetection.ts @@ -177,6 +177,9 @@ export const qLanguageIdByDocumentLanguageId: { [key: string]: CodewhispererLang vue: 'vue', yaml: 'yaml', yml: 'yaml', + // Some IDEs (e.g. VS Code) report docker-compose files with the 'dockercompose' + // language id rather than 'yaml'; treat it as YAML so completions are provided. + dockercompose: 'yaml', } export const getSupportedLanguageId = (