Skip to content

Enhance cmsis.json settings management, schema and docs - #511

Merged
brondani merged 2 commits into
mainfrom
improve-cmsis-json
Sep 7, 2026
Merged

Enhance cmsis.json settings management, schema and docs#511
brondani merged 2 commits into
mainfrom
improve-cmsis-json

Conversation

@brondani

@brondani brondani commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Changes

  • Always create or update .vscode/cmsis.json after successfully loading or saving a solution.
  • Write the effective default target type and target set when no explicit selection was made.
  • Add informational properties:
    • activeSolution: full path to the active csolution file, relative to cmsis.json.
    • activeTarget: effective target in target-type or target-type@target-set form.
  • Keep targetSet as the extension’s existing internal selection representation.
  • Preserve an existing cmsis.json when it cannot be parsed and keep cmsis.json save failures detectable.
  • Add a JSON schema and format documentation for cmsis.json.
  • Document known limitations of the existing targetSet representation.

Example generated settings:

{
  "activeSolution": "../solutions/MySolution.csolution.yml",
  "activeTarget": "MyBoard@debug",
  "targetSet": {
    "solutions/MySolution": {
      "activeTargetType": "MyBoard",
      "MyBoard": 0
    }
  }
}

This allows consumers to derive the active build command:

cbuild <activeSolution> --active <activeTarget>

Out of Scope

This PR does not change how solution, target-type, or target-set selections are authoritatively persisted or restored. In particular:

  • activeSolution and activeTarget are informational mirrors only.
  • The extension does not read these fields to restore a selection.
  • The active solution continues to be restored from VS Code workspace storage.
  • Target-type and target-set selections continue to use the existing targetSet structure.
  • The existing index-based target-set persistence format is not redesigned.
  • Stale target-set indexes are not migrated or normalized.
  • Literal dotted keys in the existing settings API are not supported by this change.

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).

Extension-owned file format documentation

This PR adds companion documentation for extension-owned file formats:

  • schemas/README.md provides an index linking each format to its human-readable documentation and machine-readable schema.
  • schemas/cmsis-settings.md documents .vscode/cmsis.json, including file ownership, informational active solution and target fields, the existing targetSet persistence format, path conventions, compatibility, and known limitations.
  • schemas/tools-environment.md documents the generated .cmsis/tools-environment.yml format, including its lifecycle, resolved environment and tool metadata, tool-selection rules, and security considerations.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Dependency Review

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

Scanned Files

None

@qltysh

qltysh Bot commented Sep 4, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.1%.

Modified Files with Diff Coverage (3)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
src/solutions/csolution.ts100.0%
Coverage rating: A Coverage rating: A
src/views/manage-solution/manage-solution-controller.ts100.0%
Coverage rating: B Coverage rating: B
src/global/cmsis-settings-json-file.ts100.0%
Total100.0%
🚦 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.

@brondani
brondani force-pushed the improve-cmsis-json branch 3 times, most recently from 8c6651e to 7257a68 Compare September 4, 2026 14:28
@brondani
brondani requested a lite review from Copilot September 4, 2026 14:46

This comment was marked as outdated.

@brondani brondani changed the title Enhance cmsis.json active solution/target selection persistence Enhance cmsis.json settings management, schema and docs Sep 7, 2026
@brondani
brondani requested a lite review from Copilot September 7, 2026 11:06

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.

🟡 Changes recommended

The manage-solution save path can still overwrite an invalid-but-existing cmsis.json after a failed read, which risks clobbering user content.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 11/12 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/views/manage-solution/manage-solution-controller.ts Outdated
@brondani
brondani marked this pull request as ready for review September 7, 2026 11:58
@jkrech

jkrech commented Sep 7, 2026

Copy link
Copy Markdown
Member

cbuild <activeSolution> --active <activeTarget>

slightly inconsistent with the usage output from cbuild and csolution:

Options:
  -a, --active arg         Select active target-set: <target-type>[@<set>]

Maybe we should review also the documentation to only use the term active target

consider updating the list command:

cbuild list target-sets CubeMX.csolution.yml

to use targets instead.

@jkrech jkrech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@arneschmid arneschmid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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.

4 participants