Theia API Documentation v1.65.0
    Preparing search index...
    interface Resource {
        autosaveable?: boolean;
        encoding?: string;
        initiallyDirty?: boolean;
        onDidChangeContents?: Event<void>;
        onDidChangeReadOnly?: Event<boolean | MarkdownString>;
        readOnly?: boolean | MarkdownString;
        uri: URI;
        version?: ResourceVersion;
        dispose(): void;
        guessEncoding?(): Promise<undefined | string>;
        readContents(options?: ResourceReadOptions): Promise<string>;
        readStream?(options?: ResourceReadOptions): Promise<ReadableStream<string>>;
        saveContentChanges?(
            changes: TextDocumentContentChangeEvent[],
            options?: ResourceSaveOptions,
        ): Promise<void>;
        saveContents?(
            content: string,
            options?: ResourceSaveOptions,
        ): Promise<void>;
        saveStream?(
            content: Readable<string>,
            options?: ResourceSaveOptions,
        ): Promise<void>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    autosaveable?: boolean

    If false, the application should not attempt to auto-save this resource.

    encoding?: string

    Latest read encoding of this resource.

    Optional if a resource does not support encoding, check with in operator`. Undefined if a resource did not read content yet.

    initiallyDirty?: boolean
    onDidChangeContents?: Event<void>
    onDidChangeReadOnly?: Event<boolean | MarkdownString>
    readOnly?: boolean | MarkdownString
    uri: URI
    version?: ResourceVersion

    Latest read version of this resource.

    Optional if a resource does not support versioning, check with in operator`. Undefined if a resource did not read content yet.

    Methods

    • Reads latest content of this resource.

      If a resource supports versioning it updates version to latest. If a resource supports encoding it updates encoding to latest.

      Parameters

      Returns Promise<string>

      ResourceError.NotFound if a resource not found

    • Applies incremental content changes to this resource.

      If a resource supports versioning clients can pass some version to check against it, if it is not provided latest version is used. It updates version to latest.

      Parameters

      Returns Promise<void>

      ResourceError.NotFound if a resource not found or was not read yet

      ResourceError.OutOfSync if latest resource version is out of sync with the given

    • Rewrites the complete content for this resource. If a resource does not exist it will be created.

      If a resource supports versioning clients can pass some version to check against it, if it is not provided latest version is used.

      It updates version and encoding to latest.

      Parameters

      Returns Promise<void>

      ResourceError.OutOfSync if latest resource version is out of sync with the given

    • Rewrites the complete content for this resource. If a resource does not exist it will be created.

      If a resource supports versioning clients can pass some version to check against it, if it is not provided latest version is used.

      It updates version and encoding to latest.

      Parameters

      Returns Promise<void>

      ResourceError.OutOfSync if latest resource version is out of sync with the given