A relative pattern is a helper to construct glob patterns that are matched relatively to a base path. The base path can either be an absolute file path or a workspace folder.

Constructors

Properties

Constructors

  • Creates a new relative pattern object with a base path and pattern to match. This pattern will be matched on file paths relative to the base path.

    Parameters

    • base: string | Uri | WorkspaceFolder

      A base file path to which this pattern will be matched against relatively.

    • pattern: string

      A file glob pattern like *.{ts,js} that will be matched on file paths relative to the base path.

    Returns RelativePattern

Properties

base: string

A base file path against which this pattern will be matched relatively.

This matches the fsPath value of RelativePattern.baseUri.

Note: updating this value will update RelativePattern.baseUri to be a uri with file scheme.

Deprecated

This property is deprecated, please use RelativePattern.baseUri instead.

baseUri: Uri

A base file path to which this pattern will be matched against relatively.

pattern: string

A file glob pattern like *.{ts,js} that will be matched on file paths relative to the base path.

Example: Given a base of /home/work/folder and a file path of /home/work/folder/index.js, the file glob pattern will match on index.js.