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

WIP: Improved Skip Patterns #167

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

eth-p
Copy link

@eth-p eth-p commented Jan 28, 2023

This is currently a work in progress commit.
I'm making a draft pull request to get your feedback on the feature and its implementation.

The idea of this pull request to improve the user experience of the "Skip patterns" setting by providing more types of patterns, a better user interface for editing the patterns, and visual feedback to know if patterns are working.

image

New Features:

  • Custom settings UI for adding/removing/changing the skip patterns.
    • Provides feedback for patterns:
      ❌ --> Invalid pattern
      ✅ --> Valid pattern
  • Glob-style patterns for skip patterns.
    • * matches everything except directories
    • ** matches directories
    • {a,b} matches either a or b
      • Like bash, {a} is invalid, so it literally matches {a}.

Fixed:

Done

  • Add support for glob-style skip patterns.
  • Add setting component for adding and removing skip patterns.

To-Do

  • Show a different icon if the pattern does not match any files in the vault (⚠️, maybe? or a non-green ✔)
  • Test that the regex created by the glob pattern compiler works as expected.
  • Synced skip patterns (like a .gitignore checked in to a repo)
  • Clean up the PatternSetSetting to use less data- attributes.
  • Allow case-sensitive/insensitive regex patterns

- Add support for glob-style skip patterns.
- Add setting component for adding and removing skip patterns.
@vrtmrz
Copy link
Owner

vrtmrz commented Jan 28, 2023

Thank you for proposing great new features.
I think it would be very useful!

I have just seen your codes only on mobile yet, this is based on only this note, and I hope to see the details later!

Show a different icon if the pattern does not match any files in the vault (⚠️, maybe? or a non-green ✔)

If we count the number of matched documents, how about indicating that?
Like: ✅ (2), ✅(0), ❌(-)
And, It might be also nice to display the beginning of the list as a tooltip of the number.

.replace(/\\\{([^}]+(?:,[^}]+)+)\\\}/, // Glob: '{a,b}'
(_, [arg]) => `(?:${arg.split(",").join("|")})`)

return new RegExp(globAsRegex);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translating a glob, to RegExp, means that things like ! can't work.
Using something like picomatch or micromatch would be better in my opinion.

@pwall2222
Copy link

Also, is this PR dead?

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.

3 participants