You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Honor EditorConfig levels for unused-include diagnostics - #14858
The extension forwarded Include Cleanup filtering rules but omitted the unused-include diagnostic level, preventing the native server from honoring that preference.
Forward cpp_include_cleanup_remove_unused_error_tag_type with each file's Include Cleanup preferences. Missing or unset values default to none, and diagnostic-level values are case-insensitive.
Include localized messages for unused and duplicate includes, plus unit coverage for defaults, supported levels, casing, and unset handling.
Fix EditorConfig precedence and refresh behavior so closer opt-outs and edits to applicable configs outside workspace folders take effect.
A companion native-side PR exists in a private repository.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are recorded for the change forwarding the unused-include diagnostic level to the native server.
No open issues 🎉
What changed in this PR
This PR adds the unused-include diagnostic level to the Include Cleanup preferences sent to the native server, allowing it to honor the per-file EditorConfig setting.
Changes:
Forward cpp_include_cleanup_remove_unused_error_tag_type, normalizing casing and defaulting missing or unset values to none.
Add localizable diagnostic messages for unused and duplicate includes.
Extend unit coverage for defaults, supported levels, casing, and unset handling.
Colen Garoutte-Carson (@Colengms) It would help if you mentioned in the description that there was a matching VS repo PR. devbox2-wsl/agent656 is the agent reviewing the VS repo PR (so it found this PR from the link there), and devbox4-wsl/agent66 is the agent that I assigned to review this PR thinking that it didn't have an associated VS repo PR.
Honor later sections and closer configuration files so local
preferences override inherited settings. Refresh applicable
configuration outside workspace folders without recursive watches,
and release watches when their documents are no longer visible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sean McManus (@sean-mcmanus) Added a note that a companion native-side PR exists. The public description intentionally contains no private-repository links.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Secondary workspace clients can retain ancestor watches after files are hidden or closed because visibility updates reach only the default client, causing duplicate watches and refresh callbacks.
Discard winning unset values after configuration inheritance
without restoring ancestor settings. Apply text options using
the active document resource and keep ancestor watchers owned by
the default client. Remove the release-note placeholder.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
EditorConfig watches are not restored when workspace folders are removed or clients recover from crashes, allowing subsequent configuration edits to leave preferences and diagnostics stale.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Client recreation fails to restore visible-editor watches
Extension/src/LanguageServer/client.ts:1953
After a language-server crash, ClientCollection.recreateClients() disposes the old client and its watchers, but restores documents through sendDidOpen() and didChangeActiveEditor(), neither of which calls prepareVisibleEditorInfo(). If the visible editors remain unchanged, the replacement client never recreates these watches, so subsequent edits to external .editorconfig files stop refreshing preferences until visibility changes. Reinitialize the default client's watcher from the current visible editors during crash recovery, or preserve watcher ownership across client recreation.
Workspace folder changes leave visible-editor watches stale
Removing a secondary workspace folder while its C++ editor stays visible leaves that folder unwatched: these directories were skipped, and the workspace watcher no longer covers them. Subsequent .editorconfig edits can leave preferences and diagnostics stale because the workspace-folder handler transfers document ownership without updating visible-editor state. Recompute the default client's ancestor watches and refresh preferences when workspace folders change.
Keep external EditorConfig preferences current after client recreation
and workspace-folder changes even when visible editors do not change.
Cover both lifecycle paths in the existing multi-root scenario suite.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Client recreation restores external EditorConfig watches even when visible editors do not change.
Workspace-folder changes refresh visible-editor preferences and watch coverage, including a removed folder whose C++ editor remains visible.
Both regressions failed before the fix and pass in a real multi-root VS Code host afterward. The existing EditorConfig tests, TypeScript build, and targeted lint also pass. No changelog or native binary-version-gate change is included.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The test calls recreateClients() outside the crash/restart lifecycle, so disposing the old default client removes shared providers and the workspace watcher without restoring them, leaving subsequent tests with a partially disabled extension host.
Exercise ClientCollection recreation with isolated client stubs instead
of disposing the extension host's live shared providers. Preserve the
watcher-restoration assertion without disabling later feature tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new wire fields and localized diagnostic IDs depend on an unavailable private native-side companion, leaving their cross-repository contract and end-to-end diagnostic behavior unvalidated.
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
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.
The extension forwarded Include Cleanup filtering rules but omitted the unused-include diagnostic level, preventing the native server from honoring that preference.
Forward
cpp_include_cleanup_remove_unused_error_tag_typewith each file's Include Cleanup preferences. Missing or unset values default tonone, and diagnostic-level values are case-insensitive.Include localized messages for unused and duplicate includes, plus unit coverage for defaults, supported levels, casing, and unset handling.
Fix EditorConfig precedence and refresh behavior so closer opt-outs and edits to applicable configs outside workspace folders take effect.
A companion native-side PR exists in a private repository.
Related to: #14857