• Public
  • Public/Protected
  • All

The workspace service.


  • WorkspaceService


  • FrontendApplicationContribution




_ready: Deferred<void> = ...
_roots: FileStat[] = []
_workspace: undefined | FileStat
deferredRoots: Deferred<FileStat[]> = ...
envVariableServer: EnvVariablesServer
fileService: FileService
fsPreferences: FileSystemPreferences
labelProvider: LabelProvider
logger: ILogger
messageService: MessageService
onWorkspaceChangeEmitter: Emitter<FileStat[]> = ...
onWorkspaceLocationChangedEmitter: Emitter<undefined | FileStat> = ...
preferenceImpl: PreferenceServiceImpl
rootWatchers: Map<string, Disposable> = ...
schemaProvider: PreferenceSchemaProvider
schemaUpdater: WorkspaceSchemaUpdater
toDisposeOnWorkspace: DisposableCollection = ...
windowService: WindowService
windowTitleService: WindowTitleService


  • get isMultiRootWorkspaceOpened(): boolean
  • get onWorkspaceChanged(): Event<FileStat[]>
  • get onWorkspaceLocationChanged(): Event<undefined | FileStat>
  • get opened(): boolean
  • get ready(): Promise<void>
  • get roots(): Promise<FileStat[]>
  • get saved(): boolean
  • get workspace(): undefined | FileStat


  • addRoot(uris: URI | URI[]): Promise<void>
  • areWorkspaceRoots(uris: URI[]): boolean
  • close(): Promise<void>
  • computeRoots(): Promise<FileStat[]>
  • containsSome(paths: string[]): Promise<boolean>
  • 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.


    • paths: string[]

    Returns Promise<boolean>

  • doGetDefaultWorkspaceUri(): Promise<undefined | string>
  • doInit(): Promise<void>
  • getDefaultWorkspaceUri(): MaybePromise<undefined | string>
  • 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>

  • getExcludes(uri: string): string[]
  • getUntitledWorkspace(): Promise<URI>
  • getWorkspaceRootUri(uri: undefined | URI): undefined | 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.


    • uri: undefined | URI

      URI of the file

    Returns undefined | URI

  • init(): void
  • isSafeToReload(withURI?: URI): Promise<boolean>
  • isUntitledWorkspace(candidate?: URI): boolean
  • isWorkspaceFile(candidate: URI | FileStat): boolean
  • onStop(): void
  • recentWorkspaces(): Promise<string[]>
  • refreshRootWatchers(): Promise<void>
  • removeRecentWorkspace(uri: string): Promise<void>
  • removeRoots(uris: URI[]): Promise<void>
  • save(uri: URI | FileStat): Promise<void>
  • setURLFragment(workspacePath: string): void
  • setWorkspace(workspaceStat: undefined | FileStat): Promise<void>
  • spliceRoots(start: number, deleteCount?: number, ...rootsToAdd: URI[]): Promise<URI[]>
  • toFileStat(uri: undefined | string | URI): Promise<undefined | FileStat>
  • toValidRoot(uri: undefined | string | URI): Promise<undefined | FileStat>
  • tryGetRoots(): FileStat[]
  • updateRoots(): Promise<void>
  • updateSchema(key: string, schema?: IJSONSchema): Promise<boolean>
  • Parameters

    • key: string

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

    • Optional schema: IJSONSchema

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

    Returns Promise<boolean>

  • updateTitle(): void
  • updateWorkspace(): Promise<void>
  • watchRoot(root: FileStat): Promise<void>
  • watchRoots(): Promise<void>
  • writeWorkspaceFile(workspaceFile: undefined | FileStat, workspaceData: WorkspaceData): Promise<undefined | FileStat>