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

    This is an implementation of #theia.Uri based on vscode-uri. This is supposed to fix https://github.com/eclipse-theia/theia/issues/8752 We cannot simply upgrade the dependency, because the current version 3.x is not compatible with our current codebase

    Hierarchy

    • URI
      • URI

    Implements

    Index

    Constructors

    • Parameters

      • scheme: string
      • Optionalauthority: string
      • Optionalpath: string
      • Optionalquery: string
      • Optionalfragment: string
      • Optional_strict: boolean

      Returns URI

    • Parameters

      • components: UriComponents

      Returns URI

    Properties

    authority: string

    authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'. The part between the first double slashes and the next slash.

    fragment: string

    fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.

    fsPath: string

    Returns a string representing the corresponding file system path of this URI. Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the platform specific path separator.

    • Will not validate the path for invalid characters and semantics.
    • Will not look at the scheme of this URI.
    • The result shall not be used for display purposes but for accessing a file on disk.

    The difference to URI#path is the use of the platform specific separator and the handling of UNC paths. See the below sample of a file-uri with an authority (UNC path).

       const u = URI.parse('file://server/c$/folder/file.txt')
    u.authority === 'server'
    u.path === '/shares/c$/file.txt'
    u.fsPath === '\\server\c$\folder\file.txt'

    Using URI#path to read a file (using fs-apis) would not be enough because parts of the path, namely the server name, would be missing. Therefore URI#fsPath exists - it's sugar to ease working with URIs that represent files on disk (file scheme).

    path: string

    path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.

    query: string

    query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.

    scheme: string

    scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'. The part before the first colon.

    Methods

    • There is quite some magic in to vscode URI class related to transferring via JSON.stringify(). Making the CodeURI instance makes sure we transfer this object as a vscode-uri URI.

      Returns UriComponents

    • Creates a string representation for this URI. It's guaranteed that calling URI.parse with the result of this function creates an URI which is equal to this URI.

      • The result shall not be used for display purposes but for externalization or transport.
      • The result will be encoded using the percentage encoding and encoding happens mostly ignore the scheme-specific encoding rules.

      Parameters

      • OptionalskipEncoding: boolean

        Do not encode the result, default is false

      Returns string

    • Override to create the correct class.

      Parameters

      • change: {
            authority?: null | string;
            fragment?: null | string;
            path?: null | string;
            query?: null | string;
            scheme?: string;
        }

      Returns URI

    • Creates a new URI from a file system path, e.g. c:\my\files, /usr/home, or \\server\share\some\path.

      The difference between URI#parse and URI#file is that the latter treats the argument as path, not as stringified-uri. E.g. URI.file(path) is not the same as URI.parse('file://' + path) because the path might contain characters that are interpreted (# and ?). See the following sample:

      const good = URI.file('/coding/c#/project1');
      good.scheme === 'file';
      good.path === '/coding/c#/project1';
      good.fragment === '';
      const bad = URI.parse('file://' + '/coding/c#/project1');
      bad.scheme === 'file';
      bad.path === '/coding/c'; // path is now broken
      bad.fragment === '/project1';

      Parameters

      • path: string

        A file system path (see URI#fsPath)

      Returns URI

    • Create an URI from its component parts

      Parameters

      • components: {
            authority?: string;
            fragment?: string;
            path?: string;
            query?: string;
            scheme: string;
        }

        The component parts of an Uri.

      Returns URI

      A new Uri instance.

    • Parameters

      • thing: any

      Returns thing is URI

    • Create a new uri which path is the result of joining the path of the base uri with the provided path segments.

      • Note 1: joinPath only affects the path component and all other components (scheme, authority, query, and fragment) are left as they are.
      • Note 2: The base uri must have a path; an error is thrown otherwise.

      The path segments are normalized in the following ways:

      • sequences of path separators (/ or \) are replaced with a single separator
      • for file-uris on windows, the backslash-character (``) is considered a path-separator
      • the ..-segment denotes the parent segment, the . denotes the current segment
      • paths have a root which always remains, for instance on windows drive-letters are roots so that is true: joinPath(Uri.file('file:///c:/root'), '../../other').fsPath === 'c:/other'

      Parameters

      • uri: URI
      • ...pathSegments: string[]

        One more more path fragments

      Returns URI

      A new uri which path is joined with the given fragments

    • Creates a new URI from a string, e.g. http://www.msft.com/some/path, file:///usr/home, or scheme:with/path.

      Parameters

      • value: string

        A string which represents an URI (see URI#toString).

      • Optional_strict: boolean

      Returns URI