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

Properties

size

size: number

The number of affected resources of textual or resource changes.

Methods

createFile

  • createFile(uri: Uri, options?: object): void
  • Create a regular file.

    Parameters

    • uri: Uri

      Uri of the new file..

    • Optional options: object

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

      • Optional ignoreIfExists?: boolean
      • Optional overwrite?: boolean

    Returns void

delete

  • Delete the text at the given range.

    Parameters

    • uri: Uri

      A resource identifier.

    • range: Range

      A range.

    Returns void

deleteFile

  • deleteFile(uri: Uri, options?: object): void
  • Delete a file or folder.

    Parameters

    • uri: Uri

      The uri of the file that is to be deleted.

    • Optional options: object
      • Optional ignoreIfNotExists?: boolean
      • Optional recursive?: boolean

    Returns void

entries

  • Get all text edits grouped by resource.

    Returns [Uri, TextEdit[]][]

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

get

  • Get the text edits for a resource.

    Parameters

    • uri: Uri

      A resource identifier.

    Returns TextEdit[]

    An array of text edits.

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.

insert

  • insert(uri: Uri, position: Position, newText: string): void
  • Insert the given text at the given position.

    Parameters

    • uri: Uri

      A resource identifier.

    • position: Position

      A position.

    • newText: string

      A string.

    Returns void

renameFile

  • renameFile(oldUri: Uri, newUri: Uri, options?: object): void
  • Rename a file or folder.

    Parameters

    • oldUri: Uri

      The existing file.

    • newUri: Uri

      The new location.

    • Optional options: object

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

      • Optional ignoreIfExists?: boolean
      • Optional overwrite?: boolean

    Returns void

replace

  • replace(uri: Uri, range: Range, newText: string): void
  • Replace the given range with given text for the given resource.

    Parameters

    • uri: Uri

      A resource identifier.

    • range: Range

      A range.

    • newText: string

      A string.

    Returns void

set

  • Set (and replace) text edits for a resource.

    Parameters

    • uri: Uri

      A resource identifier.

    • edits: TextEdit[]

      An array of text edits.

    Returns void