Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "helpers"

Index

Type aliases

NewButtonSetup

NewButtonSetup: function

A function to setup a new button.

param

new button.

param

The description.

returns

The result.

Type declaration

NewButtonSetupResult

NewButtonSetupResult: void | boolean | null | undefined

Possible results for NewButtonSetup function.

Functions

checkIfDoesMatchByFileFilter

  • checkIfDoesMatchByFileFilter(val: any, filter: FileFilter): boolean
  • Handles a value as string and checks if it does match a file filter.

    Parameters

    • val: any

      The value to check.

    • filter: FileFilter

      The filter.

    Returns boolean

    Does match or not.

cloneObjectWithoutFunctions

  • cloneObjectWithoutFunctions<T>(val: T): T
  • Clones an object / value without functions deep.

    Type parameters

    • T

    Parameters

    • val: T

      The value / object to clone.

    Returns T

    The cloned value / object.

createButton

  • createButton<TButton>(buttonDesc: TButton, setup?: NewButtonSetup<TButton>): Promise<vscode.StatusBarItem>
  • Creates a new status bar button.

    Type parameters

    Parameters

    • buttonDesc: TButton

      The description for the button.

    • Optional setup: NewButtonSetup<TButton>

    Returns Promise<vscode.StatusBarItem>

    The promise with new new button.

exec

  • exec(command: string, opts?: ExecOptions): Promise<ExecResult>
  • Executes something.

    Parameters

    • command: string

      The thing / command to execute.

    • Optional opts: ExecOptions

    Returns Promise<ExecResult>

    The promise with the result.

execFile

  • execFile(command: string, args?: any[], opts?: ExecFileOptions): Promise<ExecResult>
  • Executes a file.

    Parameters

    • command: string

      The thing / command to execute.

    • Optional args: any[]
    • Optional opts: ExecFileOptions

    Returns Promise<ExecResult>

    The promise with the result.

filterConditionalItems

  • filterConditionalItems<TItem>(items: TItem | TItem[], throwOnError?: boolean, errorResult?: any): TItem[]
  • Filters items with 'if' code.

    Type parameters

    Parameters

    • items: TItem | TItem[]

      The items to filter.

    • Default value throwOnError: boolean = false
    • Default value errorResult: any = false

    Returns TItem[]

    The filtered items.

filterPlatformItems

  • filterPlatformItems<TItem>(items: TItem | TItem[], platformDetector?: function): TItem[]
  • Filters platform specific objects.

    Type parameters

    Parameters

    • items: TItem | TItem[]

      The items to filter.

    • Optional platformDetector: function
        • (): string
        • Returns string

    Returns TItem[]

    The filtered items.

getExtensionDirInHome

  • getExtensionDirInHome(): string
  • Returns the (possible path) of the extension's sub folder inside the home directory.

    Returns string

    The path of the extension's sub folder inside the home directory.

getExtensionLogDirInHome

  • getExtensionLogDirInHome(): string
  • Returns the (possible path) of the extension's log sub folder inside the home directory.

    Returns string

    The path of the extension's log sub folder inside the home directory.

getUriParam

  • getUriParam<TDefault>(params: Object, name: string, defValue?: TDefault): string | TDefault
  • Returns the value from a "parameter" object.

    Type parameters

    • TDefault

    Parameters

    • params: Object

      The object.

    • name: string

      The name of the parameter.

    • Optional defValue: TDefault

    Returns string | TDefault

    The value of the parameter (if found). Otherwise the value of 'defValue'.

invokeForTempFile

  • Invokes an action for a temporary file.

    Type parameters

    • TResult

    Parameters

    • action: function

      The action to invoke.

        • (path: string): TResult
        • Parameters

          • path: string

          Returns TResult

    • Optional opts: InvokeForTempFileOptions

    Returns Promise<TResult>

    The result of the action.

isBool

  • isBool(val: any): boolean
  • Checks if a value is a boolean or not.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is boolean or not.

isFunc

  • isFunc<TFunc>(val: any): boolean
  • Checks if a value is a function or not.

    Type parameters

    • TFunc: Function

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is function or not.

isHex

  • isHex(val: any): boolean
  • Checks if a value represents a hex string.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Represents a hex string or not.

isNullOrUndefined

  • isNullOrUndefined(val: any): boolean
  • Checks if a value is (null) or (undefined).

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is (null)/(undefined) or not.

isObject

  • isObject<TObj>(val: any): boolean
  • Checks if a value is an object or not.

    Type parameters

    • TObj

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is object or not.

isString

  • isString(val: any): boolean
  • Checks if a value is a string or not.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is string or not.

isSymbol

  • isSymbol(val: any): boolean
  • Checks if a value is a symbol or not.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is symbol or not.

lstat

  • lstat(path: string | Buffer): Promise<Stats>
  • Promise version of 'FS.lstat()' function.

    Parameters

    • path: string | Buffer

      The path.

    Returns Promise<Stats>

    The promise with the stats.

mergeByName

  • mergeByName<TObj>(objs: TObj | TObj[], nameResolver?: function, nameNormalizer?: function): TObj | TObj[]
  • Merges objects by their names. Last items win.

    Type parameters

    Parameters

    • objs: TObj | TObj[]

      The object(s) to merge.

    • Optional nameResolver: function
        • (obj: TObj): string
        • Parameters

          • obj: TObj

          Returns string

    • Optional nameNormalizer: function
        • (name: string): string
        • Parameters

          • name: string

          Returns string

    Returns TObj | TObj[]

    The merged objects.

mkdirs

  • mkdirs(dir: string): Promise<void>
  • Promise version of 'FSExtra.mkdirs()' function.

    Parameters

    • dir: string

      The directory to create.

    Returns Promise<void>

normalizePath

  • normalizePath(path: string): string
  • Normalizes a path.

    Parameters

    • path: string

      The path to normalize.

    Returns string

    The normalized path.

open

  • open(target: string, opts?: OpenOptions): Promise<ChildProcess>
  • Opens a target.

    Parameters

    • target: string

      The target to open.

    • Optional opts: OpenOptions

    Returns Promise<ChildProcess>

openAndShowTextDocument

  • openAndShowTextDocument(filenameOrOptions?: string | object): Promise<TextEditor>
  • Opens and shows a text document.

    Parameters

    • Optional filenameOrOptions: string | object

    Returns Promise<TextEditor>

    The promise with the new text editor.

readDir

  • readDir(path: string | Buffer): Promise<string[]>
  • Promise version of 'FS.readdir()' function.

    Parameters

    • path: string | Buffer

      The path.

    Returns Promise<string[]>

    The promise with the file and folder names.

readFile

  • readFile(filename: string): Promise<Buffer>
  • Promise version of 'FS.readFile()' function.

    Parameters

    • filename: string

      The file to read.

    Returns Promise<Buffer>

    The promise with the stats.

readStream

  • readStream(stream: ReadableStream): Promise<Buffer>
  • Reads the content of a stream.

    Parameters

    • stream: ReadableStream

      The stream.

    Returns Promise<Buffer>

    The promise with the content.

replaceAllStrings

  • replaceAllStrings(str: string, searchValue: string, replaceValue: string): string
  • Replaces all occurrences of a string.

    Parameters

    • str: string

      The input string.

    • searchValue: string

      The value to search for.

    • replaceValue: string

      The value to replace 'searchValue' with.

    Returns string

    The output string.

requireFromExtension

  • requireFromExtension<TModule>(id: any): TModule
  • Imports a module from extension context.

    Type parameters

    • TModule

    Parameters

    • id: any

      The ID of the module.

    Returns TModule

    The imported module.

showErrorMessage

  • showErrorMessage<TItem>(msg: string, ...items: TItem[]): Promise<TItem>
  • Promise (and safe) version of 'vscode.window.showErrorMessage()' function.

    Type parameters

    • TItem: vscode.MessageItem

    Parameters

    • msg: string

      The message to display.

    • Rest ...items: TItem[]

    Returns Promise<TItem>

    The promise with the selected item.

showInformationMessage

  • showInformationMessage<TItem>(msg: string, ...items: TItem[]): Promise<TItem>
  • Promise (and safe) version of 'vscode.window.showInformationMessage()' function.

    Type parameters

    • TItem: vscode.MessageItem

    Parameters

    • msg: string

      The message to display.

    • Rest ...items: TItem[]

    Returns Promise<TItem>

    The promise with the selected item.

showWarningMessage

  • showWarningMessage<TItem>(msg: string, ...items: TItem[]): Promise<TItem>
  • Promise (and safe) version of 'vscode.window.showWarningMessage()' function.

    Type parameters

    • TItem: vscode.MessageItem

    Parameters

    • msg: string

      The message to display.

    • Rest ...items: TItem[]

    Returns Promise<TItem>

    The promise with the selected item.

sortByLabel

  • sortByLabel<T>(items: T | T[], valueResolver?: function): T[]
  • Sorts items by its label.

    Type parameters

    • T: object

    Parameters

    • items: T | T[]

      The item(s).

    • Optional valueResolver: function
        • (item: T): any
        • Parameters

          • item: T

          Returns any

    Returns T[]

    The sorted items.

stat

  • stat(path: string | Buffer): Promise<Stats>
  • Promise version of 'FS.stat()' function.

    Parameters

    • path: string | Buffer

      The path.

    Returns Promise<Stats>

    The promise with the stats.

toDisplayablePath

  • toDisplayablePath(path: string): string
  • Converts a path to a "displayable" one.

    Parameters

    • path: string

      The input value.

    Returns string

    The output value.

toMinimatchFileFilter

  • toMinimatchFileFilter<TFilter>(filter: TFilter): TFilter
  • Converts a file filter to a 'minimatch' compatible one.

    Type parameters

    Parameters

    • filter: TFilter

      The filter to convert.

    Returns TFilter

    The converted filter.

tryFindLanguageIdByFilename

  • tryFindLanguageIdByFilename(file: string): Promise<string>
  • Tries to find a language ID by filename.

    Parameters

    • file: string

      The (name of the) file.

    Returns Promise<string>

    The promise with the language ID (if found).

unlink

  • unlink(path: string | Buffer): Promise<void>
  • Promise version of 'FS.unlink()' function.

    Parameters

    • path: string | Buffer

      The path.

    Returns Promise<void>

uriParamsToObject

  • uriParamsToObject(uri: Url | vscode.Uri): deploy_contracts.KeyValuePairs<string>
  • Extracts the query parameters of an URI to an object.

    Parameters

    • uri: Url | vscode.Uri

      The URI.

    Returns deploy_contracts.KeyValuePairs<string>

    The parameters of the URI as object.

writeFile

  • writeFile(filename: string, data: any): Promise<void>
  • Promise version of 'FS.unlink()' function.

    Parameters

    • filename: string

      The file to write to.

    • data: any

      The data to write.

    Returns Promise<void>

Generated using TypeDoc