Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ignore root folder setting #1065

Closed

Conversation

asg0451
Copy link

@asg0451 asg0451 commented Sep 2, 2022

Fixes #1063

@riccardoferretti
Copy link
Collaborator

Thanks for taking a stab at this @asg0451

I understand the approach taken, but I am concerned that it "splits" the ignoring of files/folders into two different settings, and it only provides an on/off switch to supporting multiple workspace folders.

Have you considered a way to "incorporate" this into the behavior of foam.files.ignore?

In my originally (although limited) thinking about this issue, I was wondering whether in case there is more than one workspace folder, the glob would (not) include the folder name. For example, given:

notes/
  family/
    family.md
  business/
    business.md

and

work/
  company/
    file.md
  side-project/
    project.md

I would expect something like:

  1. if just the notes folder is open, use foam.files.ignore: ["family/**"]
  2. if a workspace with both work the notes folders is open, use foam.files.ignore: ["notes/family/**", "work/company/**"]

An alternative, which I don't know if I like tbh, is to have a map of folder to ignore patterns:

foam.files.ignore: {
  "notes": ["family/**"],
   "work": ["company/**"]
}

But honestly the array approach seems more sensible to me.

Let me know your thoughts, I admittedly haven't given this a proper deep dive, so I might be missing some edge cases

@asg0451
Copy link
Author

asg0451 commented Sep 2, 2022

hey @riccardoferretti, i understand your thinking there. my thought was that changing the meaning of the foam.files.ignore setting's elements depending on multirootness would be surprising in a bad way. though it might be clear if set in a named workspace file, users may set it elsewhere, or not even use named workspace files.

i also don't love the map idea, as it doesn't make sense for regular workspaces.

what do you think?

@riccardoferretti
Copy link
Collaborator

Yup, I can see the possible confusion, although I wonder if practically it would be clearer than the current situation - here is what I mean:

When the workspace has a single folder, you don't see the folder in the explorer, so intuitively you wouldn't use in your glob (which is also the behavior today, and the reason why on simple projects we haven't had issues).

image

When the workspace has more than a folder, then they show up in the explorer, so it does "feel" more right to include it in the glob

image

So the root folder "becomes" part of the explorer, and in the same way I can see how it could "become" part of the glob.

What do you think?

@riccardoferretti
Copy link
Collaborator

Hi @asg0451 are you still looking into this?

@asg0451
Copy link
Author

asg0451 commented Sep 15, 2022 via email

@riccardoferretti
Copy link
Collaborator

What other problem did you have? can you file an issue for that?

@asg0451
Copy link
Author

asg0451 commented Sep 16, 2022

it wasn't to do with foam at all. vscode just started taking forever to start up (load extensions / index project code) in multiroot mode.

@riccardoferretti
Copy link
Collaborator

I followed my approach in #1083, happy to hear comments

@riccardoferretti
Copy link
Collaborator

replaced by #1083

@asg0451
Copy link
Author

asg0451 commented Oct 13, 2022

looks good to me man, sorry i didnt follow through on it. i'm still off of multiroot, but maybe i'll try it again with this change 👍

@asg0451 asg0451 deleted the ignore-root-folder-setting branch October 13, 2022 16:52
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.

Exclude whole repo/Folder when using foam in a multi-root workspace
2 participants