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

[Regular Expressions] Add support for quoted find path patterns #3816

Merged
merged 4 commits into from
Aug 14, 2023

Conversation

deathaxe
Copy link
Collaborator

@deathaxe deathaxe commented Aug 2, 2023

This PR refactors File Pattern.sublime-syntax to

  1. add support for quoted path patterns (e.g.: "//my/path with,comma/*")

  2. distinguish path patterns and file patterns using meta scopes, so color schemes can choose separate highlighting for wildcards depending on their function, despite using the same constant.other.wildcard scope in both.

    • path patterns, which contain separators such as / or \, are scoped meta.path.file-pattern
    • file patterns without path separators such as *.py are scoped meta.file.file-pattern
  3. moves syntax tests to a sub directory

Brackets are just not evaluated as character classes. It doesn't mean they are
illegal. It is very ok for folder names to contain brackets.
This commit aligns file name with the replace pattern test file.
This commit...

1. updates syntax to version 2
2. adds support for quoted path patterns
3. adds dedicated set of contexts for both kinds of patterns to correctly
   distinct wildcard scopes, depending on their usage.

   That's required because ST treats `*` differently, depending on whether `/`
   is present in a pattern or not and users request distinct scopes for being
   able to apply different colors.

   color schemes can use:

   - meta.file.file-pattern constant.other.wildcard
   - meta.path.file-pattern constant.other.wildcard
This commit moves all syntax tests to a "tests" sub directory
to follow the scheme of other syntax packages in this repo.
@michaelblyons
Copy link
Collaborator

I have been misreading the documentation for years. 🤦‍♂️

@deathaxe deathaxe merged commit 5df0b69 into sublimehq:master Aug 14, 2023
2 checks passed
@deathaxe deathaxe deleted the pr/regexp/refactor-file-patterns branch August 14, 2023 16:24
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