Theia API Documentation v1.65.0
    Preparing search index...

    The workspace service.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _ready: Deferred<void>
    _roots: FileStat[]
    _workspace: undefined | FileStat
    collabWorkspace?: Workspace
    connection?: ProtocolBroadcastConnection
    deferredRoots: Deferred<FileStat[]>
    envVariableServer: EnvVariablesServer
    fileService: FileService
    fsPreferences: FileSystemPreferences
    labelProvider: LabelProvider
    logger: ILogger
    messageService: MessageService
    onWorkspaceChangeEmitter: Emitter<FileStat[]>
    onWorkspaceLocationChangedEmitter: Emitter<undefined | FileStat>
    preferenceImpl: PreferenceService
    rootWatchers: Map<string, Disposable>
    schemaUpdater: WorkspaceSchemaUpdater
    toDisposeOnWorkspace: DisposableCollection
    untitledWorkspaceService: UntitledWorkspaceService
    windowService: WindowService
    windowTitleService: WindowTitleService
    workspaceFileService: WorkspaceFileService

    Accessors

    • get isMultiRootWorkspaceOpened(): boolean

      Returns true if a multiple-root workspace is currently open.

      Returns boolean

    • get onWorkspaceChanged(): Event<FileStat[]>

      Returns Event<FileStat[]>

    • get onWorkspaceLocationChanged(): Event<undefined | FileStat>

      Returns Event<undefined | FileStat>

    • get opened(): boolean

      Returns true if theia has an opened workspace or folder

      Returns boolean

    • get ready(): Promise<void>

      Returns Promise<void>

    • get roots(): Promise<FileStat[]>

      Returns Promise<FileStat[]>

    • get saved(): boolean

      true if the current workspace is configured using a configuration file.

      false if there is no workspace or the workspace is simply a folder.

      Returns boolean

    • get workspace(): undefined | FileStat

      Returns undefined | FileStat

    Methods

    • Adds root folder(s) to the workspace

      Parameters

      • uris: URI | URI[]

        URI or URIs of the root folder(s) to add

      Returns Promise<void>

    • Parameters

      Returns Promise<boolean>

    • Clears current workspace root.

      Returns Promise<void>

    • Return true if one of the paths in paths array is present in the workspace NOTE: You should always explicitly use / as the separator between the path segments.

      Parameters

      • paths: string[]

      Returns Promise<boolean>

    • Returns Promise<undefined | string>

    • Returns Promise<void>

    • Resolves to the default workspace URI as string.

      The default implementation tries to extract the default workspace location from the window.location.hash, then falls-back to the most recently used workspace root from the server.

      It is not ensured that the resolved workspace URI is valid, it can point to a non-existing location.

      Returns MaybePromise<undefined | string>

    • Parameters

      • uri: string

      Returns string[]

    • Returns the relative path of the given file to the workspace root.

      Parameters

      • uri: URI

        URI of the file

      Returns Promise<string>

      getWorkspaceRootUri(uri)

    • Returns the workspace root uri that the given file belongs to. In case that the file is found in more than one workspace roots, returns the root that is closest to the file. If the file is not from the current workspace, returns undefined.

      Parameters

      • uri: undefined | URI

        URI of the file

      Returns undefined | URI

    • Returns void

    • Parameters

      • OptionalwithURI: URI

      Returns Promise<boolean>

    • Check if the file should be considered as a workspace file.

      Example: We should not try to read the contents of an .exe file.

      Parameters

      Returns boolean

    • on unload, we set our workspace root as the last recently used on the backend.

      Returns void

    • Opens directory, or recreates a workspace from the file that uri points to.

      Parameters

      Returns void

    • Returns Promise<string[]>

    • Parameters

      • uri: string

      Returns Promise<void>

    • Removes root folder(s) from workspace.

      Parameters

      Returns Promise<void>

    • Save workspace data into a file

      Parameters

      • uri: URI | FileStat

        URI or FileStat of the workspace file

      Returns Promise<void>

    • Set the URL fragment to the given workspace path.

      Parameters

      • workspacePath: string

      Returns void

    • Parameters

      Returns Promise<void>

    • Parameters

      • start: number
      • OptionaldeleteCount: number
      • ...rootsToAdd: URI[]

      Returns Promise<URI[]>

    • returns a FileStat if the argument URI points to a file or directory. Otherwise, undefined.

      Parameters

      • uri: undefined | string | URI

      Returns Promise<undefined | FileStat>

    • returns a FileStat if the argument URI points to an existing directory. Otherwise, undefined.

      Parameters

      • uri: undefined | string | URI

      Returns Promise<undefined | FileStat>

    • Returns Promise<void>

    • Parameters

      • key: string

        the property key under which to store the schema (e.g. tasks, launch)

      • Optionalschema: IJSONSchema

        the schema for the property. If none is supplied, the update is treated as a deletion.

      Returns Promise<boolean>

    • Returns Promise<void>

    • Returns Promise<void>