Protected_Protected_Protected_Protected OptionalcollabProtectedcomputedThe names of the roots read by the last computeRoots, not yet published.
ProtectedconfiguredThe names of the roots, published together with _roots when onWorkspaceChanged fires.
ProtectedconfiguredThe configured root names by the string of a root URI as passed to getConfiguredRootName,
for the configuredRootNames they were looked up in.
Protected OptionalconnectionProtecteddeferredProtected ReadonlyenvProtected ReadonlyfileProtected ReadonlyfsProtected ReadonlylabelProtected ReadonlyloggerProtected ReadonlymessageProtected ReadonlyonProtected ReadonlyonProtected ReadonlyopenProtected ReadonlypreferenceProtectedpreferencesProtectedrootThe root names, and the names by root URI, which depend on each other. Reset whenever the roots change.
Protected ReadonlyrootProtected ReadonlyschemaProtected ReadonlyschemaProtected ReadonlyserverProtected ReadonlytoProtected ReadonlyuntitledProtected ReadonlywindowProtected ReadonlywindowProtected ReadonlyworkspaceProtected ReadonlyworkspaceReturns true if a multiple-root workspace is currently open.
Returns true if theia has an opened workspace or folder
true if the current workspace is configured using a configuration file.
false if there is no workspace or the workspace is simply a folder.
ProtectedareClears current workspace root.
ProtectedcomputeProtectedcomputeProtectedcomputeComputes the workspace roots. Also sets computedRootNames to the names given to the roots in the workspace file,
which updateRoots publishes with the roots, see getConfiguredRootName.
An override that does not call super has to set computedRootNames itself, otherwise the names of the previous roots remain.
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.
ProtecteddoProtecteddoProtecteddoOptionaloptions: WorkspaceInputProtectedentryReturns the name given to the workspace root by the name property of its folder entry in the workspace file.
This is the name shown for the root, as WorkspaceFolder.name in VS Code. Unlike the unique names of getRootNames,
it is chosen by the user and not used to address files.
URI of the workspace root
the name of the root, or undefined if the root has no name or is not a workspace root
ProtectedgetResolves 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.
ProtectedgetReturns the name of the given workspace root, as assigned by getRootNames, or
undefined if the URI is not a workspace root.
Returns a unique name for each workspace root, in workspace order.
A root is named after its directory basename, e.g. backend. Roots that share a basename are
treated as peers: each of them is named after the shortest tail of its path that tells them
apart, e.g. alice/app and bob/app. A name that another name starts with, e.g. alice next to
alice/app, is qualified in the same way, e.g. work/alice, so that every path resolves to the root
it came from. The names are thus always the ending of the real path, so they match what appears in
terminal output, compiler errors and the like.
These are the root names used by getRootPrefixedPath and resolved by resolveRootPrefixedPath.
ProtectedgetReturns a workspace-relative path prefixed with the containing root's
directory name, e.g. backend/src/index.ts.
In a single-root workspace the root name is still included so that the format is consistent regardless of how many roots are open.
Falls back to the absolute filesystem path if the URI is not contained in any workspace root.
URI of the file
ProtectedgetProtectedgetReturns the relative path of the given file to the workspace root.
URI of the file
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 of the file
ProtectedinitProtectedisReturns true if the current window is connected to a remote backend.
In remote sessions, we must not overwrite the local MRU with the remote
workspace's file URI, as the local MRU should retain the remote connection
URI (e.g. devcontainer://...) so the session can be restored on restart.
Detection: the backend port is always in ?port=. When connected to a
remote, the URL also has ?localPort= (the original backend port).
OptionalwithURI: URIOptionalcandidate: URIProtectedisOn unload, we set our workspace root as the last recently used on the backend.
In the browser, we use onStop (fire-and-forget) because onWillStop actions
are never executed during browser tab close and returning an OnWillStopAction
would trigger an unwanted "Leave site?" confirmation dialog.
In Electron, we use onWillStop so the workspace is persisted before the window closes.
Called on beforeunload event, right before the window closes.
Return true or an OnWillStopAction in order to prevent exit.
Note: No async code allowed, this function has to run on one tick.
Opens directory, or recreates a workspace from the file that uri points to.
Optionaloptions: WorkspaceInputProtectedopenOptionaloptions: WorkspaceInputProtectedopenOptionaloptions: WorkspaceInputOptionaloptions: WorkspaceInputProtectedqualifyAdds the next parent segment to the name of a root, unless the name is its whole path or its URI already.
whether the name was qualified
ProtectedqualifyQualifies a root name that another root name starts with, e.g. alice next to alice/app, by more
segments of its path, as a path in the one root would otherwise resolve to the other. If the root
named alice/app is the app folder of the root named alice, the names are left as they are:
the nested root is then also the one that getRootPrefixedPath names its files after.
ProtectedrefreshProtectedreloadOptionaloptions: WorkspaceInputResolves a path in the format of getRootPrefixedPath, i.e. <rootName>/<relativePath>
or a bare <rootName>, to a URI. If more than one root name is a prefix of the path, which is
the case when a root named a has a subfolder b and another root is named a/b, the longest
one wins.
undefined if the path is absolute, does not start with a root name or leaves its root.
Resolves a path that contains the basename of a workspace root, preceded by nothing or by the
trailing segments of the root's parent path, e.g. bob/app/src for the root /home/bob/app.
Unlike resolveRootPrefixedPath, this does not depend on the current root names, so it
also resolves paths that were prefixed with a root name before the workspace roots changed.
the distinct candidates in workspace order, which are several if the path is ambiguous, or none if the path is absolute, leaves its root or does not contain the basename of a root.
ProtectedresolveResolves segments against the given root as described in resolveSupraRelativePath.
ProtectedsetProtectedsetSet the URL fragment to the given workspace path.
ProtectedsetProtectedshouldOptionaloptions: WorkspaceInputRemoves deleteCount roots starting at start and inserts the given roots there, and writes the result to the workspace file.
A root to add can be given a name, which is written to the workspace file as the name of its folder entry.
OptionaldeleteCount: numberthe URIs of the removed roots
Splits a /-separated path that starts with a root name, as in getRootPrefixedPath, into
that root and the rest of the path, which is empty for a bare root name. The rest is not normalized,
so it may as well be a glob. If more than one root name is a prefix of the path, the longest one wins.
undefined if the path does not start with a root name.
ProtectedtoProtectedtoProtectedupdatethe 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.
ProtectedupdateProtectedupdateProtectedwatchProtectedwatchProtectedwrite
The workspace service.