Skip to content

Make autoTestDiscoverOnSavePattern mergeable across settings scopes - #26291

Open
Mohammad Malik (mohammad-malik) wants to merge 1 commit into
microsoft:mainfrom
mohammad-malik:cursor/autotest-discover-on-save-pattern-46ab
Open

Mohammad Malik (mohammad-malik) wants to merge 1 commit into
microsoft:mainfrom
mohammad-malik:cursor/autotest-discover-on-save-pattern-46ab

Conversation

@mohammad-malik

Copy link
Copy Markdown

Fixes #24848

Summary

python.testing.autoTestDiscoverOnSavePattern is now an object of glob patterns mapped to booleans. VS Code merges that object across default, user, workspace, and folder settings the same way it merges files.exclude and search.exclude, so a pattern set in user settings and another set in workspace settings both apply. Set a pattern to false to turn off that one pattern from a broader scope, including the default **/*.py.

A saved file triggers discovery when it matches any enabled pattern. Patterns are matched against the workspace-relative path and the absolute path, and Windows separators are normalized before matching.

A previously saved string glob is still honored at runtime, so existing settings keep working. A string replaces the whole value and is not merged across scopes. The setting contribution is now an object, matching the files.exclude editor, so a saved string can show a schema warning until it is switched to the object form.

How I tested

With Node 22.21.1:

  • npx tsc -p ./ (one-shot equivalent of npm run compile, which is tsc -watch)
  • npm run lint
  • npm run format-check
  • npm run test:unittests — 5289 passing, 38 pending

Change the setting to an object of glob patterns mapped to booleans so VS Code
merges entries the same way it merges files.exclude. A saved string glob is
still honored.

Co-authored-by: Mohammad Malik <mohammad-malik@users.noreply.github.com>
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.

Improve autoTestDiscoverOnSavePattern to be more robust

1 participant