asRelativePath

fun asRelativePath(pathOrUri: JsAny, includeWorkspaceFolder: Boolean = definedExternally): String(source)

Returns a path that is relative to the workspace folder or folders.

When there are no workspace folders or when the path is not contained in them, the input is returned.

Parameters

pathOrUri

A path or uri. When a uri is given its fsPath is used.

includeWorkspaceFolder

When true and when the given path is contained inside a workspace folder the name of the workspace is prepended. Defaults to true when there are multiple workspace folders and false otherwise.