From c2d2ed81967a97cb3431f1ea08351bef4c2eab7f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 14 Jan 2022 09:51:10 +0100 Subject: [PATCH] glob - document exactly syntax of patterns --- src/vs/base/common/glob.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/vs/base/common/glob.ts b/src/vs/base/common/glob.ts index c9520857740..3df7a7435c9 100644 --- a/src/vs/base/common/glob.ts +++ b/src/vs/base/common/glob.ts @@ -428,11 +428,12 @@ function toRegExp(pattern: string): ParsedStringPattern { /** * Simplified glob matching. Supports a subset of glob patterns: - * - * matches anything inside a path segment - * - ? matches 1 character inside a path segment - * - ** matches anything including an empty path segment - * - simple brace expansion ({js,ts} => js or ts) - * - character ranges (using [...]) + * * `*` to match one or more characters in a path segment + * * `?` to match on one character in a path segment + * * `**` to match any number of path segments, including none + * * `{}` to group conditions (e.g. *.{ts,js} matches all TypeScript and JavaScript files) + * * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + * * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) */ export function match(pattern: string | IRelativePattern, path: string): boolean; export function match(expression: IExpression, path: string, hasSibling?: (name: string) => boolean): string /* the matching pattern */; @@ -446,11 +447,12 @@ export function match(arg1: string | IExpression | IRelativePattern, path: strin /** * Simplified glob matching. Supports a subset of glob patterns: - * - * matches anything inside a path segment - * - ? matches 1 character inside a path segment - * - ** matches anything including an empty path segment - * - simple brace expansion ({js,ts} => js or ts) - * - character ranges (using [...]) + * * `*` to match one or more characters in a path segment + * * `?` to match on one character in a path segment + * * `**` to match any number of path segments, including none + * * `{}` to group conditions (e.g. *.{ts,js} matches all TypeScript and JavaScript files) + * * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + * * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) */ export function parse(pattern: string | IRelativePattern, options?: IGlobOptions): ParsedPattern; export function parse(expression: IExpression, options?: IGlobOptions): ParsedExpression;