Use command displayName for CodeLens button text with blank-name fallback#16909
Use command displayName for CodeLens button text with blank-name fallback#16909
Conversation
- Add DisplayName property to ResourceCommandJson (C# shared model) - Map DisplayName in ResourceSnapshotMapper and TelemetryExportService - Add displayName to TypeScript ResourceCommandJson interface - Use displayName for CodeLens button title, description for tooltip Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/d3063561-9cf3-45e3-b2e9-65ee168099f9 Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16909Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16909" |
|
@copilot Fix the failing tests |
There was a problem hiding this comment.
Pull request overview
Updates the Aspire resource command JSON shape so VS Code CodeLens buttons use the short command display name for the button text, while keeping the longer description for tooltips—improving readability for custom commands.
Changes:
- Add
DisplayNameto the sharedResourceCommandJsonmodel and populate it from both the CLI snapshot mapper and Dashboard telemetry export. - Extend the VS Code extension’s
ResourceCommandJsoninterface withdisplayName. - Update CodeLens rendering to prefer
displayNamefor the label and usedescriptionfor tooltip text.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Shared/Model/Serialization/ResourceJson.cs | Adds DisplayName to the shared command JSON model. |
| src/Aspire.Dashboard/Model/TelemetryExportService.cs | Maps command display name into exported ResourceJson. |
| src/Aspire.Cli/Backchannel/ResourceSnapshotMapper.cs | Maps backchannel command DisplayName into ResourceCommandJson. |
| extension/src/views/AppHostDataRepository.ts | Adds displayName to the extension’s command JSON interface. |
| extension/src/editor/AspireCodeLensProvider.ts | Uses displayName for CodeLens button title; keeps description for tooltip. |
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/95c8316c-4458-48d9-8ca5-894fc10fb4ab Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Addressed in 9095e96. I fixed the extension test fixtures for the new Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/94a11f1e-98cf-49fc-acfd-12d1e35de7be Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Applied in 07c0be5. Blank/whitespace command display names now normalize correctly in the CLI mapper and fall back to the command name in CodeLens, with regression coverage added for both paths. No screenshot attached because this only affects fallback behavior for empty/whitespace command metadata. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
maddymontaquila
left a comment
There was a problem hiding this comment.
i mean fix the tests but i tried it and it looks great !!!!
Description
CodeLens buttons for custom resource commands were using the
descriptionfield as button text, which can be very long (for example, "Stop the resource, rebuild the project from source, and restart..."). The button text should be the shortdisplayName; thedescriptionbelongs in the tooltip.This change also normalizes empty or whitespace-only command display names so clients safely fall back to the command name instead of rendering a blank CodeLens label or tooltip.
Changes:
DisplayNametoResourceCommandJson(shared C# model) and map it in bothResourceSnapshotMapperandTelemetryExportServicedisplayNameto the TypeScriptResourceCommandJsoninterfacedisplayNamefor CodeLens button label, fall back todescriptionfor tooltipResourceSnapshotMapperso serialized JSON emitsnulland downstream clients can fall back safelydisplayNameordescriptionvalues fall back to the command namedisplayNamefield on resource commandsChecklist
<remarks />and<code />elements on your triple slash comments?