Skip to content

Allow Exact Match For Filters#1649

Open
tthornton3-chwy wants to merge 2 commits into
microsoft:mainfrom
tthornton3-chwy:feature/allow-exact-match
Open

Allow Exact Match For Filters#1649
tthornton3-chwy wants to merge 2 commits into
microsoft:mainfrom
tthornton3-chwy:feature/allow-exact-match

Conversation

@tthornton3-chwy
Copy link
Copy Markdown
Contributor

I was having cases where filters were matching inappropriately, for example with composite builds. This lets you have an exact match syntax. I know it's a bit niche, but I do think it's useful/I personally use it!

@tthornton3-chwy
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@chagong
Copy link
Copy Markdown
Contributor

chagong commented Jun 8, 2026

Thanks, this is a reasonable addition and the trailing-separator approach is backward compatible. One blocker and two smaller asks before merge:

Windows separator gap. The typical config form is !${workspaceFolder}/build/classes/ — after resolution that's an absolute path with forward slashes and a trailing /. Since it's absolute, path.join is skipped, so on Windows exclude.endsWith('\\') is false and exact-match silently never triggers. A Windows user would have to hand-write backslashes. Suggest making the check separator-agnostic and running it before normalization:

if (/[\\/]$/.test(exclude)) {
    exclude = exclude.slice(0, -1);
    isDirect = true;
} else {
    isDirect = this.isFilePath(exclude);
}

Docs. The trailing-slash convention isn't discoverable — can you update java.debugger.launch.classPaths.exclude and modulePaths.exclude in package.nls.json to mention it? It's also slightly counter-intuitive (a trailing slash usually implies a directory/prefix, here it means exact match), so a clear note helps.

Test. A small unit test covering the new exact-match path in filterExcluded would be good given this logic is filesystem-sensitive and currently untested.

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.

2 participants