VS Code API
    Preparing search index...

    Class WorkspaceEdit

    A workspace edit is a collection of textual and files changes for multiple resources and documents.

    Use the applyEdit-function to apply a workspace edit.

    Index

    Constructors

    Properties

    size: number

    The number of affected resources of textual or resource changes.

    Methods

    • Create a regular file.

      Parameters

      • uri: Uri

        Uri of the new file.

      • Optionaloptions: {
            contents?: Uint8Array<ArrayBufferLike> | DataTransferFile;
            ignoreIfExists?: boolean;
            overwrite?: boolean;
        }

        Defines if an existing file should be overwritten or be ignored. When overwrite and ignoreIfExists are both set overwrite wins. When both are unset and when the file already exists then the edit cannot be applied successfully. The content-property allows to set the initial contents the file is being created with.

        • Optional Readonlycontents?: Uint8Array<ArrayBufferLike> | DataTransferFile

          The initial contents of the new file.

          If creating a file from a drop operation, you can pass in a DataTransferFile to improve performance by avoiding extra data copying.

        • Optional ReadonlyignoreIfExists?: boolean

          Do nothing if a file with uri exists already.

        • Optional Readonlyoverwrite?: boolean

          Overwrite existing file. Overwrite wins over ignoreIfExists

      • Optionalmetadata: WorkspaceEditEntryMetadata

        Optional metadata for the entry.

      Returns void

    • Delete a file or folder.

      Parameters

      • uri: Uri

        The uri of the file that is to be deleted.

      • Optionaloptions: { ignoreIfNotExists?: boolean; recursive?: boolean }
        • Optional ReadonlyignoreIfNotExists?: boolean

          Do nothing if a file with uri exists already.

        • Optional Readonlyrecursive?: boolean

          Delete the content recursively if a folder is denoted.

      • Optionalmetadata: WorkspaceEditEntryMetadata

        Optional metadata for the entry.

      Returns void

    • Check if a text edit for a resource exists.

      Parameters

      • uri: Uri

        A resource identifier.

      Returns boolean

      true if the given resource will be touched by this edit.

    • Rename a file or folder.

      Parameters

      • oldUri: Uri

        The existing file.

      • newUri: Uri

        The new location.

      • Optionaloptions: { ignoreIfExists?: boolean; overwrite?: boolean }

        Defines if existing files should be overwritten or be ignored. When overwrite and ignoreIfExists are both set overwrite wins.

        • Optional ReadonlyignoreIfExists?: boolean

          Do nothing if a file with uri exists already.

        • Optional Readonlyoverwrite?: boolean

          Overwrite existing file. Overwrite wins over ignoreIfExists

      • Optionalmetadata: WorkspaceEditEntryMetadata

        Optional metadata for the entry.

      Returns void