Skip to content

Add !-prefix parsing to glob util #134415

@JacksonKearl

Description

@JacksonKearl

It'd be potentially useful to have ! as a prefix added to our glob.ts utils. This could function similarly to how we already handle .gitignore files in the webworker search here:

  1. if a file matches a normal line and doesn't match an !-line, exclude it (we do this today)
  2. If it matches both a normal line and a !-line, include it
  3. Otherwise, include it (we do this today)

This isn't quite as powerful as a real.gitignore as there are only two "layers" of include/exclude, whereas in gitignore each line introduces a new "layer", but I believe it would handle the 99% of cases well enough, for instance every example given to-date in #869.

To handle the many-layer case requires either:

  • migrating to an array to configure files.exclude and search.exclude, which is undesirable from a backwards/forwards compatibility perspective
  • taking care to ensure the existing *.exclude objects are handled in a key-order sensitive way, which is potentially undesirable from a JSON/JS object semantics compatibility perspective

cc @bpasero for any and all input on this

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityfile-globFile glob engine

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions