Skip to content

Switch run generator command to use active target-set and extend diagnostics#337

Open
brondani wants to merge 1 commit into
mainfrom
run-generator-active-target-set
Open

Switch run generator command to use active target-set and extend diagnostics#337
brondani wants to merge 1 commit into
mainfrom
run-generator-active-target-set

Conversation

@brondani

@brondani brondani commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Changes

The Run Generator command previously passed a context string to csolution run via -c. This change passes the active <target-type>[@<target-set>] with the -a flag instead. This aligns with the csolution CLI's preferred way of addressing context selection by active target.

In addition, generator run output is now routed through the diagnostic pipeline so that any csolution error/ warning lines appear in the Problems panel — consistent with convert and cbuild output.

  • Generator Command Enhancement
    • Added activeTarget?: string to RunGeneratorRequest interface
    • Modified handler to accept activeTarget parameter
    • Captures output lines during execution for diagnostic processing
    • New: Fires generator completion event
  • Diagnostic Resolution
    • Added optional getActiveTargetSetName constructor parameter
    • Enables dependency injection for testability while maintaining zero-dependency defaults
  • Event Hub Enhancement
    • Added new interface method, event and emitter for generator run completion
    • Enables generator diagnostics to be processed identically to convert/cbuild diagnostics
  • Solution Outline Tree Integration
    • Enables context menu commands to use current active target set

Screenshots

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@qltysh

qltysh Bot commented Jun 26, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

⬇️ Merging this pull request will decrease total coverage on main by 0.02%.

Modified Files with Diff Coverage (5)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
src/tasks/generator/generator-command.ts83.3%114-116
Coverage rating: A Coverage rating: A
...ution-outline/tree-structure/solution-outline-project-items.ts100.0%
Coverage rating: A Coverage rating: A
src/solutions/solution-event-hub.ts100.0%
Coverage rating: A Coverage rating: A
src/solutions/problem-diagnostic-action-resolver.ts100.0%
Coverage rating: A Coverage rating: A
src/solutions/solution-problems.ts40.0%288-290
Total83.8%
🤖 Increase coverage with AI coding...
In the `run-generator-active-target-set` branch, add test coverage for this new code:

- `src/solutions/solution-problems.ts` -- Line 288-290
- `src/tasks/generator/generator-command.ts` -- Line 114-116

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the VS Code extension’s Run Generator workflow to prefer the CMSIS Toolbox csolution run active target selection (-a <target-type>[@<target-set>]) instead of passing a build context string (-c), and routes generator output through the existing diagnostics pipeline so generator-related errors/warnings surface in the Problems panel like convert/cbuild.

Changes:

  • Switch generator invocation to accept and forward activeTarget (and keep legacy context support where still provided).
  • Add a generator-run completion event to the solution event hub and consume it in SolutionProblems to produce diagnostics from generator output.
  • Propagate activeTarget into solution-outline “component-gen” nodes and update reference dumps/tests accordingly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test-data/solutions/USBD/CmsisViewTreeRef.txt Updates reference tree dump output to use activeTarget instead of cbuild-context.
test-data/solutions/USBD/CmsisViewTreeOneProjRef.txt Same as above for the single-project reference dump.
src/views/solution-outline/tree-structure/solution-outline-tree.test.ts Adds tests validating activeTarget attribute population on component-gen nodes.
src/views/solution-outline/tree-structure/solution-outline-project-items.ts Sets activeTarget attribute for generator nodes using active target set or parsed target type.
src/tasks/generator/generator-command.ts Updates generator command dispatch/argument construction and emits generator-run completion for diagnostics.
src/tasks/generator/generator-command.test.ts Extends unit tests to cover activeTarget usage and legacy/combined inputs.
src/solutions/solution-problems.ts Subscribes to generator-run completion and adds generator output to diagnostics.
src/solutions/solution-problems.test.ts Adjusts tests for new subscription count and run-generator diagnostic action payload.
src/solutions/solution-event-hub.ts Adds generator-run completion event + emitter.
src/solutions/solution-event-hub.test.ts Updates subscription-count expectation after adding the new emitter.
src/solutions/problem-diagnostic-action-resolver.ts Changes “run generator” diagnostic actions to use activeTarget and allows optional active target-set provider injection.
src/solutions/problem-diagnostic-action-resolver.test.ts Updates/extends tests to validate activeTarget behavior and target-set precedence.
src/desktop/extension.ts Wires SolutionEventHub into GeneratorCommand construction.

Comment thread src/tasks/generator/generator-command.ts
Comment thread src/tasks/generator/generator-command.test.ts
Comment thread src/tasks/generator/generator-command.test.ts
@brondani brondani marked this pull request as ready for review June 26, 2026 16:56
@brondani brondani requested a review from edriouk June 26, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants