Skip to main content

Module WorkspaceContainsGlob

Module WorkspaceContainsGlob 

Source
Expand description

Workspace-contains glob matcher for VS Code workspaceContains:<pattern> activation events.

Matching semantics mirror VS Code’s ExtensionService.scanExtensions:

  • Bare filename → exact match at workspace root
  • Path with slashes → direct descendant match
  • **/pattern → any descendant up to depth 3
  • Single * → one path segment wildcard

Bounded to depth 3 and 4096 entries per root so activation checks stay sub-100 ms on large monorepos.

Functions§

FindMatchingWorkspaceContainsPatterns
Return the subset of Patterns for which at least one workspace folder contains a matching file or directory.
PatternMatchesAnyEntry
Check whether Pattern matches any entry in Entries. Supports literal paths, * (one segment), and ** (any segments). Case-sensitive per the VS Code spec.
SegmentMatch
Recursive segment-by-segment glob match. ** consumes zero or more path segments; * matches exactly one segment via SingleSegmentMatch.
SingleSegmentMatch
Match a single path segment against a pattern that may contain *. ? is not supported (rare in workspaceContains patterns) and falls through to literal equality.