feat(compose): expose "Compose Logs" command configuration in settings#346
feat(compose): expose "Compose Logs" command configuration in settings#346SamuelJoseph23 wants to merge 2 commits into
Conversation
Adds a new configuration setting `containers.commands.composeLogs` to allow customization of the command used for viewing Compose group logs. This enables users to pass additional flags like `--names` or adjust `--tail` via the "Compose Logs" command template, addressing limitations where Podman Compose logs lacked container names by default. - Added `containers.commands.composeLogs` to package.json - Implemented [selectComposeLogsCommand](cci:1://file:///c:/Users/samue/Documents/GitHub/vscode-containers/src/commands/selectCommandTemplate.ts:80:0-101:1) in command template selection - Updated [composeGroupLogs](cci:1://file:///c:/Users/samue/Documents/GitHub/vscode-containers/src/commands/containers/composeGroup.ts:15:0-24:1) to use the configurable template Closes microsoft#323
|
@microsoft-github-policy-service agree |
|
Apologies for how long it's taken to get to reviewing this--I haven't forgotten though! |
# Conflicts: # package.json
There was a problem hiding this comment.
Pull request overview
Exposes a new containers.commands.composeLogs command-template setting so users can customize the command used by View Logs for Compose groups (e.g., to support Podman Compose --names), aligning Compose logs with the existing command-template model.
Changes:
- Added a new
composeLogstemplate command andselectComposeLogsCommand()helper to resolve and execute Compose log templates. - Updated Compose group “View Logs” to use the command-template pipeline instead of the orchestrator client’s
logs()call. - Contributed the new
containers.commands.composeLogssetting (schema + localized descriptions) with a default template.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extensions/vscode-containers/src/commands/selectCommandTemplate.ts | Adds composeLogs template support and a new selection helper for Compose logs. |
| extensions/vscode-containers/src/commands/containers/composeGroup.ts | Switches Compose group logs to run via the new template selection path. |
| extensions/vscode-containers/package.nls.json | Adds localized strings for the new composeLogs setting descriptions. |
| extensions/vscode-containers/package.json | Contributes the containers.commands.composeLogs setting and its default template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const labels = await getComposeGroupLabels(node); | ||
| const workingDirectory = labels && getComposeWorkingDirectory(labels); | ||
| let folder; | ||
| if (workingDirectory) { | ||
| folder = workspace.getWorkspaceFolder(Uri.file(workingDirectory)); | ||
| } | ||
| return selectComposeLogsCommand(context, folder, options.files?.join('" -f "'), options.projectName, options.environmentFile); |
| "default": [ | ||
| { | ||
| "label": "Compose Logs", | ||
| "template": "${composeCommand} ${configurationFile} ${projectName} logs --tail 1000 -f" |
There was a problem hiding this comment.
I think that's reasonable since this is a compose group command
bwateratmsft
left a comment
There was a problem hiding this comment.
Reasonable suggestions by the robot
Expose "Compose Logs" command configuration
Description
This Pull Request exposes the "Compose Logs" command configuration to VS Code settings. This allows users to fully customize the command template used when viewing logs for a Compose group, bringing it to parity with the existing "Container Logs" configuration.
Motivation & Context
Previously, the extension used a hardcoded command for Compose logs (
logs --tail 1000 -f). This limited flexibility, particularly for Podman Compose users who often need to add the--namesflag to distinguish between different containers in the log stream.With this change, users can now define their own command templates via the
containers.commands.composeLogssetting, enabling them to customize flags (e.g., adding--namesor changing the--tailcount) to better suit their development workflow.How Has This Been Tested?
I have verified this change locally by:
containers.commands.composeLogssetting in VS Code to include the--namesflag.Related Issue
Closes #323