Skip to content

fix: restore coverage measurement, read settings per document, activate on demand - #327

Merged
pascalre merged 6 commits into
masterfrom
feat/coverage-and-settings
Nov 20, 2026
Merged

pascalre merged 6 commits into
masterfrom
feat/coverage-and-settings

Conversation

@pascalre

Copy link
Copy Markdown
Owner

No description provided.

pascalre and others added 6 commits November 20, 2026 07:10
Coverage dropped from 92.4% to 15.8% on 2026-11-05 on two unrelated
branches at once (7f7cafa, 8f52445), so the cause was the CI
environment, not a code change. nyc instruments every file below the
project root that the wrapped processes load, and .vscode-test was not
excluded. A newer VS Code version propagates nyc's require hook into
its extension host, so the built-in VS Code extensions (e.g.
TypeScriptTeam.jsts-chat-features) were counted as well and our code
became a small part of the measured lines.

Restrict nyc to the compiled extension and its sources. Both patterns
are needed: nyc remaps out/*.js to src/*.ts via the source maps and
applies include/exclude again afterwards. Tests are excluded.

Replace the text-lcov reporter, which dumped the whole lcov file into
the CI log, with the per-file text table.

Verified locally with a simulated VS Code extension file loaded during
the unit tests: 43% before (the foreign file counted), 91% after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
Settings mixed two models: most values were read once into fields, but
getSchema(), getQuotingType(), getCustomSortKeywords() and
getExtensions() read the workspace configuration again on every call.
Setting `settings.schema` on an instance therefore had no effect, and
the class could not be created for a specific configuration.

Read every value once from a configuration passed to the constructor
(default: the global and workspace settings) and let the getters
return the fields. Remove VsCodeAdapter.getProperty(), a second way
into the configuration that only its test used.

No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
YamlUtil created its ProcessorController without settings, the spacing
and tabs-to-spaces processors created their own, formatYaml() dumped
with a new JsYamlAdapter and sortDocuments() validated with one. Each
of them read the global settings instead of the ones YamlUtil was
created with, so e.g. emptyLinesUntilLevel, the processor switches,
indent or schema of injected settings were partly ignored.

Pass the settings through instead. With the global settings, as used
today, the result is the same; this is the precondition for reading
the settings per document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
The settings were always read without a scope and declared without a
`scope`, so VS Code ignored workspace folder settings in a multi-root
workspace and language specific settings such as
`"[yaml]": { "vscode-yaml-sort.indent": 4 }`. In addition, the
controller created separate snapshots for each of its collaborators.

Declare the settings as language-overridable (`extensions` as
resource, `notifySuccess` stays global) and add
Settings.forDocument(). The controller, the formatter and the
recursive sort create one snapshot for the processed document, or for
each file, and pass it on. With global settings only, nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
…mmands

The extension was activated on onStartupFinished, i.e. in every
workspace on every start of VS Code, even without a single yaml file.

Activate on onLanguage:yaml, which registers the formatter before the
first yaml document can be formatted, and on each contributed command.
The onCommand events have to be listed explicitly, because
engines.vscode is ^1.49.0 and VS Code derives them automatically only
since 1.74. A test checks that the list matches the contributed
commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
The command contributions carried `"when": "editorLangId == yaml"`,
but `when` is no property of contributes.commands and VS Code ignores
it, so sort, custom sort, format and validate were offered in the
command palette for every file.

Move the conditions to menus.commandPalette, where VS Code evaluates
them, and check them in the manifest test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jdb5is9YsMnteaxHryN26M
@sonarqubecloud

Copy link
Copy Markdown

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@pascalre pascalre changed the title Feat/coverage and settings fix: restore coverage measurement, read settings per document, activate on demand Nov 20, 2026
@pascalre
pascalre merged commit fc942bc into master Nov 20, 2026
9 of 10 checks passed
@pascalre
pascalre deleted the feat/coverage-and-settings branch November 20, 2026 07:54
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.

1 participant