Having trouble excluding a folder from a scope

Answered

Hi, I'm trying to create a scope that shows the files under buildSrc and buildSrc/src while excluding buildSrc/build but I can't figure it out.

This shows the files under buildSrc but shows additional files I don't want to see.

file[*buildSrc*]:*/

These do exactly the same, including files found under buildSrc/build/generated-sources/

file[*buildSrc*]:*/&&!file:*/build//*
file[*buildSrc*]:*/&&!file[*buildSrc*]:*/build//*

I think I've tried every combination of * / [ ] and : but nothing helps.

If I select the folders I don't want and click on "exclude recursively" it adds the following

&&!file[orx.buildSrc.main]:*/

which hides a bunch of files I do want to see.

Any ideas? I wish this was just a plain regex...

0
6 comments

If you go to Settings (⌘ + , on macOS or Ctrl + Alt + S on Win/Linux) > Appearance & Behavior > Scopes > select needed scope > select the Project view in the dropdown > then mark BuildSrc (project root) as Include Recursively and BuildSrc/build** folder as Exclude Recursively:

Does that create a scope you need?

0

Thank you for writing! Actually it's not working for me.

In case you want to try, the repo is this: https://github.com/openrndr/orx

  • I start with no scopes.
  • I add a new scope and type * in the Pattern to see some files
  • I click on buildSrc and click Include Recursively. This adds subfolders of buildSrc which is good.
  • I delete *|| from the beginning of the pattern to only see buildSrc. Ok.
  • I see what I want plus buildSrc/build/ which I don't want.
  • I choose one of the three buildSrc/build/ and choose Exclude Recursively
  • buildSrc/build/ disappears. Everything else disappears except one file.
0

Can you try excluding following folders in the project window (right-click on folder > Mark Directory as > Excluded):
buildSrc/build/generated-sources/kotlin-dsl-accessors/kotlin
buildSrc/build/generated-sources/kotlin-dsl-external-plugin-spec-builders/kotlin
buildSrc/build/generated-sources/kotlin-dsl-plugins/kotlin

After that you should be able to normally include/exclude buildSrc subfolders in scopes.
The issue with partially excluded folders seems to be similar to this one: https://youtrack.jetbrains.com/issue/IDEA-170796

0

I tried but couldn't get it to show the content of buildSrc and buildSrc/src/ while hiding buildSrc/build/.

What I'm doing is writing a Gradle Task to automatically create a scopes.xml file to make the project view less cluttered (for users of OPENRNDR). Here a video showing it in action:

https://user-images.githubusercontent.com/108264/221540406-7f0ab00b-6957-42d6-9ad9-c21c3c9ea585.mp4

Framework users are not affected by this (no buildSrc). Framework developers will have to remember not to click on Expand all: those folders contain hundreds of files.

Right clicking to exclude folders wouldn't be ideal (and unfortunately didn't work).

Thank you again :)

0

Yes, unfortunately the workaround to: exclude those build/ subfolders as content roots - would break the project build, so it is not really useful.
I managed to reproduce the issue and couldn't find any workaround to exclude the mentioned subfolders from the scope pattern. We have a bug already filed for this issue, however it is pretty old: https://youtrack.jetbrains.com/issue/IDEA-131199. I added your case to it. You can vote for it and follow its progress.

0

Issue voted and followed.

Thank you for taking a look into it :)

0

Please sign in to leave a comment.