fix: support inline completions in Docker Compose files#2784
Draft
laileni-aws wants to merge 1 commit into
Draft
fix: support inline completions in Docker Compose files#2784laileni-aws wants to merge 1 commit into
laileni-aws wants to merge 1 commit into
Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2784 +/- ##
==========================================
- Coverage 60.20% 60.05% -0.16%
==========================================
Files 281 281
Lines 71191 71194 +3
Branches 4575 4547 -28
==========================================
- Hits 42861 42754 -107
- Misses 28241 28352 +111
+ Partials 89 88 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Amazon Q inline suggestions are not provided in Docker Compose files. Some IDEs (notably VS Code) identify
docker-compose.yaml/docker-compose.ymlwith the editor language iddockercomposerather thanyaml.In
shared/languageDetection.ts,getLanguageIdresolves a document's language by:qLanguageIdByDocumentLanguageId, thenlanguageByExtension.dockercomposewas not present inqLanguageIdByDocumentLanguageId, so the language id itself resolved to "unsupported". These files only worked when the extension fallback happened to match.yaml/.yml, and the inline completion handler logslanguageId [dockercompose] not supportedfor the language-id path.Fix
Map
dockercomposetoyamlinqLanguageIdByDocumentLanguageId, so the language is resolved directly from the reported language id (and consistently with the existing.yaml/.ymlextension handling). Docker Compose files now receive the same completion support as other YAML files.Because this is the shared Flare language server, the fix applies to every IDE that defers language support to the server (e.g. JetBrains and Eclipse send the document to the server without a client-side language allowlist).
Testing
server/aws-lsp-codewhisperer/src/shared/languageDetection.test.ts:getLanguageIdmaps thedockercomposelanguage id toyaml;getSupportedLanguageIdresolves adockercomposedocument toyaml(a supported language).languageDetectionunit tests: all passing (8/8).prettier --checkandeslintpass on the changed files.Notes