Repository navigation
fix: restore coverage measurement, read settings per document, activate on demand - #327
Merged
Merged
Conversation
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
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 7 |
| Duplication | 0 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.