Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • RipgrepSearchInWorkspaceServer

Implements

Index

Constructors

Properties

client: undefined | SearchInWorkspaceClient
logger: ILogger
nextSearchId: number = 1
ongoingSearches: Map<number, RawProcess> = ...
rawProcessFactory: RawProcessFactory
rgPath: string

Methods

  • addGlobArgs(args: Set<string>, patterns: string[], exclude?: boolean): void
  • cancel(searchId: number): Promise<void>
  • dispose(): void
  • The default search paths are set to be the root paths associated to a workspace however the search scope can be further refined with the include paths available in the search options. This method will replace the searching paths to the ones specified in the 'include' options but as long as the 'include' paths can be successfully validated as existing.

    Therefore the returned array of paths can be either the workspace root paths or a set of validated paths derived from the include options which can be used to perform the search.

    Any pattern that resulted in a valid search path will be removed from the 'include' list as it is provided as an equivalent search path instead.

    Parameters

    Returns string[]

  • getAbsolutePathFromPattern(root: string, pattern: string): undefined | string
  • Transform include/exclude option patterns from relative patterns to absolute patterns. E.g. './abc/foo.' to '${root}/abc/foo.', the transformation does not validate the pattern against the file system as glob suffixes remain.

    Parameters

    • root: string
    • pattern: string

    Returns undefined | string

    undefined if the pattern cannot be converted into an absolute path.

  • getRoot(filePath: string, rootUris: string[]): URI
  • Returns the root folder uri that a file belongs to. In case that a file belongs to more than one root folders, returns the root folder that is closest to the file. If the file is not from the current workspace, returns empty string.

    Parameters

    • filePath: string

      string path of the file

    • rootUris: string[]

      string URIs of the root folders in the current workspace

    Returns URI

  • isPatternRelative(pattern: string): boolean
  • replaceRelativeToAbsolute(roots: string[], patterns?: string[]): string[]
  • Transforms relative patterns to absolute paths, one for each given search path. The resulting paths are not validated in the file system as the pattern keeps glob information.

    Parameters

    • roots: string[]
    • patterns: string[] = []

    Returns string[]

    The resulting list may be larger than the received patterns as a relative pattern may resolve to multiple absolute patterns up to the number of search paths.

  • By default, sets the search directories for the string WHAT to the provided ROOTURIS directories and returns the assigned search id.

    The include / exclude (options in SearchInWorkspaceOptions) are lists of patterns for files to include / exclude during search (glob characters are allowed).

    include patterns successfully recognized as absolute paths will override the default search and set the search directories to the ones provided as includes. Relative paths are allowed, the application will attempt to translate them to valid absolute paths based on the applicable search directories.

    Parameters

    Returns Promise<number>

  • wrapUpSearch(searchId: number, error?: string): void