Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Workspace

Handles a workspace.

Hierarchy

  • WorkspaceBase
    • Workspace

Implements

  • Disposable
  • Workspace

Index

Constructors

constructor

  • Initializes a new instance of that class.

    Parameters

    • id: number

      The ID of the workspace.

    • folder: WorkspaceFolder

      The folder instance.

    • context: WorkspaceContext

      The context.

    Returns Workspace

Properties

Protected _DISPOSABLES

_DISPOSABLES: Disposable[]

Stores disposable sub objects.

Protected _INTERVALS

_INTERVALS: Timer[]

Stores intervals.

Private _QUEUE

_QUEUE: PQueue<PriorityQueue, DefaultAddOptions> = ego_helpers.createQueue()

Protected _TIMEOUTS

_TIMEOUTS: Timer[]

Stores timeouts.

Private _configSrc

_configSrc: WorkspaceConfigSource

Private _isInitialized

_isInitialized: boolean = false

Private _scriptStates

_scriptStates: ego_contracts.FileStateStorage

Private _settings

context

The context.

folder

folder: WorkspaceFolder

id

id: number

The ID of the workspace.

instanceState

instanceState: object

A key/value pair for data for that instance.

Type declaration

  • [key: string]: any

isDisposed

isDisposed: boolean

Gets if object has been disposed or not.

isDisposing

isDisposing: boolean

Gets if the 'dispose()' method is currently executed or not.

isInFinalizeState

isInFinalizeState: boolean

Gets if the object is disposed or currently disposing.

rootPath

rootPath: string
inheritdoc

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

configSource

  • get configSource(): WorkspaceConfigSource
  • inheritdoc

    Returns WorkspaceConfigSource

isInitialized

  • get isInitialized(): boolean
  • Gets if workspace has been initialized or not.

    Returns boolean

logger

  • get logger(): Logger
  • Gets the logger of that workspace.

    Returns Logger

output

  • get output(): OutputChannel
  • Gets the output channel.

    Returns OutputChannel

scriptStates

  • get scriptStates(): ego_contracts.FileStateStorage
  • The storage with script states.

    Returns ego_contracts.FileStateStorage

settings

  • Gets the current settings.

    Returns WorkspaceSettings

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

Protected cleanupIntervals

  • cleanupIntervals(): void
  • Cleansup all timeouts.

    Returns void

Protected cleanupTimeouts

  • cleanupTimeouts(): void
  • Cleansup all timeouts.

    Returns void

dispose

  • dispose(): void
  • inheritdoc

    Returns void

doesMatchFilterCondition

  • Checks if a conditional object does match items condition.

    Parameters

    Returns boolean

    Matches condition or not.

doesMatchPlatformCondition

  • Checks if a platform object does match the (current) platform.

    Parameters

    Returns boolean

    Matches condition or not.

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

executeCode

  • executeCode(code: string, values?: Value | Value[]): any
  • Executes code for that workspace.

    Parameters

    • code: string

      The code to execute.

    • Optional values: Value | Value[]

    Returns any

    The result of the execution.

executeOnEditorChangedEvents

  • executeOnEditorChangedEvents<TObj>(objs: TObj | TObj[], codeExecutor?: function): void
  • Executes the code in 'onEditorChanged' of an object for that workspace.

    Type parameters

    Parameters

    • objs: TObj | TObj[]

      One or more objects.

    • Optional codeExecutor: function

      A custom code executor.

        • (code: string, obj: TObj): any
        • Parameters

          • code: string
          • obj: TObj

          Returns any

    Returns void

executeScript

  • executeScript<TArgs, TSettings>(settings: TSettings, argsFactory: function): Promise<any>
  • Executes a script.

    Type parameters

    Parameters

    • settings: TSettings

      The object with the settings.

    • argsFactory: function

      The function that produces the argument object for the execution.

        • (args: TArgs, settings: TSettings): TArgs | PromiseLike<TArgs>
        • Parameters

          • args: TArgs
          • settings: TSettings

          Returns TArgs | PromiseLike<TArgs>

    Returns Promise<any>

    The promise with the result of the execution.

filterConditionals

  • filterConditionals<TObj>(objs: TObj | TObj[]): TObj[]
  • Filters "conditional" items.

    Type parameters

    Parameters

    • objs: TObj | TObj[]

      The objects to check.

    Returns TObj[]

    The filtered items.

filterForPlatform

  • filterForPlatform<TObj>(objs: TObj | TObj[]): TObj[]
  • Filters "platform" items.

    Type parameters

    Parameters

    • objs: TObj | TObj[]

      The objects to check.

    Returns TObj[]

    The filtered items.

getApps

  • Returns all apps of that workspace.

    Returns WorkspaceApp[]

    The list of apps.

getCommands

  • Returns all commands of that workspace.

    Returns WorkspaceCommand[]

    The list of commands.

getConfigImports

  • Returns all config imports of that workspace.

    Returns WorkspaceConfigImport[]

    The list of config imports.

getEvents

  • Returns all events of that workspace.

    Returns WorkspaceEvent[]

    The list of events.

getEventsBy

  • Returns all events of that workspace by type.

    Parameters

    • type: string

      The type.

    Returns WorkspaceEvent[]

    The list of events.

getExistingFullPath

  • getExistingFullPath(p: string): string | false
  • Returns the full path of an existing file.

    Parameters

    • p: string

      The input path value.

    Returns string | false

    The full path or (false) if not found.

getFolderLookups

  • getFolderLookups(): string[]
  • Returns the list of folders to lookup for relative paths.

    Returns string[]

    Folder lookups.

getInfo

  • Returns the information about that workspace.

    Returns WorkspaceInfo

    The workspace information.

getJobs

  • Returns all jobs of that workspace.

    Returns WorkspaceJob[]

    The list of jobs.

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getValues

  • getValues(all?: boolean): Value[]
  • Returns the list of all values.

    Parameters

    • Optional all: boolean

    Returns Value[]

    The list of values.

importValues

  • importValues<TObj>(obj: TObj, clone?: boolean): TObj
  • Imports values to an object.

    Type parameters

    Parameters

    • obj: TObj

      The object where to import the values in.

    • Optional clone: boolean

    Returns TObj

    The object that contains the imported values.

initialize

  • initialize(): Promise<boolean>
  • Initializes the workspace.

    Returns Promise<boolean>

isInGit

  • isInGit(p: string): boolean
  • Checks if a path is inside the '.git' folder.

    Parameters

    • p: string

      The path to check.

    Returns boolean

    Is in '.git' folder or not.

isInVscode

  • isInVscode(p: string): boolean
  • Checks if a path is inside the '.vscode' folder.

    Parameters

    • p: string

      The path to check.

    Returns boolean

    Is in '.vscode' folder or not.

isPathOf

  • isPathOf(path: string): boolean
  • Checks if a path is part of that workspace.

    Parameters

    • path: string

      The path to check.

    Returns boolean

    Is part of that workspace or not.

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

onDidChangeConfiguration

  • onDidChangeConfiguration(e: ConfigurationChangeEvent): Promise<void>
  • inheritdoc

    Parameters

    • e: ConfigurationChangeEvent

    Returns Promise<void>

onDidOpenTextDocument

  • onDidOpenTextDocument(doc: TextDocument): Promise<void>
  • Is invoked when a text document has been opened.

    Parameters

    • doc: TextDocument

      The underlying text document.

    Returns Promise<void>

onDidSaveTextDocument

  • onDidSaveTextDocument(doc: TextDocument): Promise<void>
  • Is invoked when a text document has been saved.

    Parameters

    • doc: TextDocument

      The underlying text document.

    Returns Promise<void>

Protected onDispose

  • onDispose(): void
  • inheritdoc

    Returns void

Private onDocumentOpened

  • onDocumentOpened(doc: TextDocument): Promise<void>
  • Parameters

    • doc: TextDocument

    Returns Promise<void>

Private onFileChange

  • onFileChange(type: FileChangeType, file: Uri, doc?: TextDocument, ...args: any[]): Promise<void>
  • Parameters

    • type: FileChangeType
    • file: Uri
    • Optional doc: TextDocument
    • Rest ...args: any[]

    Returns Promise<void>

onWillSaveTextDocument

  • onWillSaveTextDocument(e: TextDocumentWillSaveEvent): Promise<void>
  • Is invoked when a text document is going to be saved.

    Parameters

    • e: TextDocumentWillSaveEvent

      The event arguments.

    Returns Promise<void>

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

raiseConfigImportsChanged

  • raiseConfigImportsChanged(): Promise<void>
  • Raises the event that config imports have changed.

    Returns Promise<void>

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

Private reloadConfiguration

  • reloadConfiguration(): Promise<void>
  • Returns Promise<void>

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

replaceValues

  • replaceValues(val: any): string
  • Handles a value as string and replaces placeholders.

    Parameters

    • val: any

      The input value.

    Returns string

    The output value.

Private resolveValuePath

  • resolveValuePath(p: string): string | false
  • Parameters

    • p: string

    Returns string | false

runShellCommand

  • Runs a shell command for that workspace and shows it progress in the GUI.

    Parameters

    Returns Promise<void>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

toFullPath

  • toFullPath(p: string): string | false
  • Converts to a full path.

    Parameters

    • p: string

      The path to convert.

    Returns string | false

    The pull path or (false) if 'path' could not be converted.

toRelativePath

  • toRelativePath(p: string): string | false
  • Converts to a relative path.

    Parameters

    • p: string

      The path to convert.

    Returns string | false

    The relative path or (false) if 'p' could not be converted.

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc