“workspaceModel.fileIndexContributor” implementation of “registerExclusionCondition” is being ignored

I’ve implemented workspaceModel.fileIndexContributor to use registerExclusionCondition to report directories matching very specific qualities as automatically excluded. I can see this logic returning true correctly from the function that is the second argument to registerExclusionCondition for exactly the directories that should be excluded, but those directories are not actually being treated as excluded by the IDE.

This is my second implementation of this EP, and the original one works just fine. The notable difference is that all directories excluded by the original one are immediate children of a content root, whereas in the one that doesn’t work, the excluded directories are nested several levels below the content root.

Any idea how to determine why this isn’t working? I’ve tried setting key breakpoints and, as stated above, I see the correct responses being returned by the exclusion logic, but when I step out things get pretty hairy pretty quickly in terms of bitmasks and similar used to build/maintain indexed VFS state. Before I continue down that path, I figured it wouldn’t hurt to ask here and see if I could save myself a bit of time.

Debugging this a bit more today, it’s specifically not allowing me to mark directories as excluded if they are under a configured source root. If they’re outside of any source root, no issues, but if they’re under a source root, the dynamic exclusion is ignored. I can mark these directories as excluded explicitly and it’s respected, but not when reported by workspaceModel.fileIndexContributor via registerExclusionCondition. Any idea why that might be? Any idea how I can mark these as excluded in an automated fashion aside from updating the module root model explicitly?