Skip to content

Improve extension AppHost output handling and CodeLens anchors#16799

Closed
adamint wants to merge 1 commit into
microsoft:mainfrom
adamint:dev/adamint/extension-apphost-polish
Closed

Improve extension AppHost output handling and CodeLens anchors#16799
adamint wants to merge 1 commit into
microsoft:mainfrom
adamint:dev/adamint/extension-apphost-polish

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented May 5, 2026

Description

Improves several extension-only AppHost UX paths without requiring CLI or hosting changes:

  • Buffers Aspire CLI stdout/stderr by line in the debug session so partial chunks do not split output across debug-console lines.
  • Sets CLI child-process stdout/stderr encoding to UTF-8 so multi-byte characters are preserved across chunk boundaries.
  • Stops prefixing every stderr line with ; CLI/Spectre error output already includes the appropriate prefix, while benign stderr messages such as update notifications should not be labeled as failures.
  • Avoids an infinite aspire describe --follow restart loop when the follow process exits before producing data.
  • Anchors CodeLens state/actions for single-resource fluent chains at the statement start, while preserving per-call anchoring for multi-resource chains.

Validation:

  • npm run compile-tests
  • npm run unit-test | grep -A3 "AspireCodeLensProvider resource lens anchoring"

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings May 5, 2026 21:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16799

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16799"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Aspire VS Code extension UX around (1) workspace aspire describe --follow watching behavior, (2) debug-session CLI output rendering, and (3) CodeLens anchoring for fluent resource declarations—without requiring any CLI/hosting changes.

Changes:

  • Prevents an infinite restart loop when aspire describe --follow exits without producing any data (common when no AppHost is running / --follow unsupported).
  • Buffers Aspire CLI stdout/stderr by line in debug sessions (and forces UTF-8 decoding) to avoid chunk-splitting issues and corrupted multi-byte characters; stops adding an extra “❌” prefix to every stderr line.
  • Adjusts CodeLens anchoring logic so single-resource fluent chains anchor at the statement start, while multi-resource chains keep per-call anchoring; adds unit tests for this behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extension/src/views/AppHostDataRepository.ts Stops quietly (no auto-restart) when describe --follow exits without producing data; keeps backoff restart only for previously-working streams.
extension/src/debugger/languages/cli.ts Sets stdout/stderr stream encoding to UTF-8 and passes decoded string chunks through callbacks.
extension/src/debugger/AspireDebugSession.ts Adds per-stream line buffering + exit-time flush; removes blanket stderr “❌” prefixing and preserves chunk integrity.
extension/src/editor/AspireCodeLensProvider.ts Updates resource CodeLens anchor selection based on whether resources share the same statement start.
extension/src/test/aspireCodeLensProvider.test.ts Adds mocha types reference and unit tests validating CodeLens anchoring behavior for single- vs multi-resource fluent chains.

@adamint
Copy link
Copy Markdown
Member Author

adamint commented May 5, 2026

Superseded by #16795, which now includes this focused slice.

@adamint adamint closed this May 5, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 5, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants