Interface FileOperationHandler

Shared service for handling file changes such as file creation, deletion and renaming. The interface methods are optional, so they are only registered if they are implemented.

interface FileOperationHandler {
    fileOperationOptions: FileOperationOptions;
    didCreateFiles?(params: CreateFilesParams): void;
    didDeleteFiles?(params: DeleteFilesParams): void;
    didRenameFiles?(params: RenameFilesParams): void;
    willCreateFiles?(params: CreateFilesParams): MaybePromise<null | WorkspaceEdit>;
    willDeleteFiles?(params: DeleteFilesParams): MaybePromise<null | WorkspaceEdit>;
    willRenameFiles?(params: RenameFilesParams): MaybePromise<null | WorkspaceEdit>;
}

Properties

fileOperationOptions: FileOperationOptions

These options are reported to the client as part of the ServerCapabilities.

Methods

  • Called before files are actually created as long as the creation is triggered from within the client either by a user action or by applying a workspace edit. This request must be registered with the fileOperationOptions.

    Parameters

    • params: CreateFilesParams

    Returns MaybePromise<null | WorkspaceEdit>

    a WorkspaceEdit which will be applied to workspace before the files are created.

  • Called before files are actually deleted as long as the deletion is triggered from within the client either by a user action or by applying a workspace edit. This request must be registered with the fileOperationOptions.

    Parameters

    • params: DeleteFilesParams

    Returns MaybePromise<null | WorkspaceEdit>

    a WorkspaceEdit which will be applied to workspace before the files are deleted.

  • Called before files are actually renamed as long as the rename is triggered from within the client either by a user action or by applying a workspace edit. This request must be registered with the fileOperationOptions.

    Parameters

    • params: RenameFilesParams

    Returns MaybePromise<null | WorkspaceEdit>

    a WorkspaceEdit which will be applied to workspace before the files are renamed.