feat(Search) Allow to disable the recursive search for configuration files - #22
Open
Cyclodex wants to merge 1 commit into
Open
feat(Search) Allow to disable the recursive search for configuration files#22Cyclodex wants to merge 1 commit into
Cyclodex wants to merge 1 commit into
Conversation
…files Adds two settings, the current recursive search stays the default: - unwantedExtensions.recursiveSearch: when disabled, only the .vscode folder at the root of every workspace folder is used, like VSCode itself resolves .vscode/extensions.json - unwantedExtensions.excludePattern: makes the previously hardcoded node_modules exclusion configurable The log now also states which search mode was used. Closes #13 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVJgAMGSmA4uMn2i88FTke
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.
Closes #13
Problem
getExtensionsJson()searched with the glob**/.vscode/extensions*.{json,jsonc}, so every subfolder of the workspace was scanned and all matches were merged into one flat config. That is the intended "subfolder support" from 1.1.2, but it also means a checked out sample project, a submodule or a vendored package can bring its own.vscode/extensions.jsonalong and apply it to the whole workspace — which is what was reported in #13.It also diverges from VS Code itself, which only resolves
.vscode/extensions.jsonat the root of each workspace folder.Two related limitations:
node_moduleswas the only hardcoded exclusion, and becausefindFiles()was called with an explicit exclude string, the defaults derived fromfiles.exclude/search.excludeno longer applied — so there was no way to narrow the search at all.Solution
Two new settings. The current recursive search stays the default, so no existing setup changes behavior.
unwantedExtensions.recursiveSearchtruefalse→ only<workspaceFolder>/.vscode/extensions*.{json,jsonc}per rootunwantedExtensions.excludePattern**/node_modules/**Both are
windowscoped, since the search spans the whole workspace — a per-folder value would have been silently ignored in a multi-root setup.Changes
package.json: added acontributes.configurationblock (the extension contributed no settings before)src/utils.ts: extracted the file lookup intofindExtensionConfigFiles(). The recursive branch is the previous behavior with the exclude pattern now configurable; the non-recursive branch usesvscode.RelativePatternper workspace folder, so multi-root keeps working and the*.code-workspacehandling is untouchedREADME.md: new "Limit the search to the workspace root" section incl. the settings tableCHANGELOG.md:[Unreleased]entryVerification
tsc --noEmitpassesnpm run lintandnpm ciwere already failing onmainbefore this branch (eslint 9 expects a flat config while the repo has.eslintrc.json; the lockfile carries@types/vscode@1.107.0whilepackage.jsonpins1.74.0). Both are untouched here.Left out on purpose
1.2.4. The odd/even convention inVERSIONING.mdmakes 1.3.x vs 1.4.x a release-type decision, andRELEASE.mdalso asks for areleaseMessages.conf.tsentry.unwantedRecommendationsand logging which file each id came from — both would help diagnose exactly this class of surprise, but they are separate from the reported issue. Happy to add them here or in a follow-up.Generated by Claude Code