Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • WorkspaceEdit

Index

Constructors(1)

Properties(1)

Methods(10)

Constructors(1)

constructor

Properties(1)

Readonly size

size: number

The number of affected resources of textual or resource changes.

Methods(10)

replace

  • Replace the given range with given text for the given resource.

    Parameters

    Returns void

insert

  • Insert the given text at the given position.

    Parameters

    Returns void

delete

has

  • has(uri: Uri): boolean
  • 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.

set

get

  • Get the text edits for a resource.

    Parameters

    • uri: Uri

      A resource identifier.

    Returns TextEdit[]

    An array of text edits.

createFile

  • Create a regular file.

    Parameters

    • uri: Uri

      Uri of the new file.

    • Optional options: { overwrite?: boolean; ignoreIfExists?: boolean; contents?: Uint8Array | DataTransferFile }

      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 Readonly overwrite?: boolean

        Overwrite existing file. Overwrite wins over ignoreIfExists

      • Optional Readonly ignoreIfExists?: boolean

        Do nothing if a file with uri exists already.

      • Optional Readonly contents?: Uint8Array | 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 metadata: WorkspaceEditEntryMetadata

      Optional metadata for the entry.

    Returns void

deleteFile

  • Delete a file or folder.

    Parameters

    • uri: Uri

      The uri of the file that is to be deleted.

    • Optional options: { recursive?: boolean; ignoreIfNotExists?: boolean }
      • Optional Readonly recursive?: boolean

        Delete the content recursively if a folder is denoted.

      • Optional Readonly ignoreIfNotExists?: boolean

        Do nothing if a file with uri exists already.

    • Optional metadata: WorkspaceEditEntryMetadata

      Optional metadata for the entry.

    Returns void

renameFile

  • Rename a file or folder.

    Parameters

    • oldUri: Uri

      The existing file.

    • newUri: Uri

      The new location.

    • Optional options: { overwrite?: boolean; ignoreIfExists?: boolean }

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

      • Optional Readonly overwrite?: boolean

        Overwrite existing file. Overwrite wins over ignoreIfExists

      • Optional Readonly ignoreIfExists?: boolean

        Do nothing if a file with uri exists already.

    • Optional metadata: WorkspaceEditEntryMetadata

      Optional metadata for the entry.

    Returns void

entries

  • Get all text edits grouped by resource.

    Returns [Uri, TextEdit[]][]

    A shallow copy of [Uri, TextEdit[]]-tuples.

Generated by TypeDoc. Maintained by 洛竹