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

Negation patterns in foam.files.ignore #1422

Open
n8layman opened this issue Feb 8, 2025 · 4 comments
Open

Negation patterns in foam.files.ignore #1422

n8layman opened this issue Feb 8, 2025 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@n8layman
Copy link
Contributor

n8layman commented Feb 8, 2025

Is your feature request related to a problem? Please describe.

It would be nice to be able to configure foam.files.ignore to exclude all files/folders except a specific directory (e.g., resources/notes/**). However, negation patterns (!) do not seem to work as expected. Both of the following just ignore everything in the open workspace.

    "files.exclude": {
      // Hide everything except the "notes" folder
      "**": true,
      "resources/notes/**": false // Explicitly include this folder
    }

or

"foam.files.ignore": [
  "!resources/notes/**",
  "**/*"
]

Describe the solution you'd like

Enabling exclusion or negation patterns would make it a lot easier to limit foam to a single folder.

Describe alternatives you've considered

The only viable alternative I see right now is to specify every other folder except the one we don't want excluded manually which isn't very scalable.

Screenshots or Videos

No response

@n8layman
Copy link
Contributor Author

n8layman commented Feb 8, 2025

Or maybe add something like files.include or foam.files.regard that takes a higher priority than ignore?

@n8layman
Copy link
Contributor Author

n8layman commented Feb 9, 2025

Another reason this would be useful, if there isn't already another way to do it, is to limit foam to indexing only a specific extension (e.g., *.md).

@n8layman
Copy link
Contributor Author

n8layman commented Feb 9, 2025

If there is some other way to limit foam to a single folder in the project tree that would also work for me.

@riccardoferretti
Copy link
Collaborator

Yeah it would make sense to have a foam.files.include which would limit the files scanned by Foam.
Especially if you can have more than it would serve the great majority of cases.
The file discovery algorithm would be something like:

  1. find files to include
    • by default */
    • if foam.files.include is defined, use that
  2. from the previous list, exclude anything that matches a pattern from the exclude patterns

@riccardoferretti riccardoferretti added this to the backlog milestone Feb 10, 2025
@riccardoferretti riccardoferretti added the enhancement New feature or request label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants