Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TextDocumentWillSaveEvent

An event that is fired when a document will be saved.

To make modifications to the document before it is being saved, call the waitUntil-function with a thenable that resolves to an array of text edits.

层级

  • TextDocumentWillSaveEvent

索引

Properties(2)

Methods(1)

Properties(2)

Readonly document

document: TextDocument

The document that will be saved.

Readonly reason

The reason why save was triggered.

Methods(1)

waitUntil

  • Allows to pause the event loop and to apply pre-save-edits. Edits of subsequent calls to this function will be applied in order. The edits will be ignored if concurrent modifications of the document happened.

    Note: This function can only be called during event dispatch and not in an asynchronous manner:

    workspace.onWillSaveTextDocument(event => {
        // async, will *throw* an error
        setTimeout(() => event.waitUntil(promise));
    
        // sync, OK
        event.waitUntil(promise);
    })
    

    Parameters

    Returns void

  • Allows to pause the event loop until the provided thenable resolved.

    Note: This function can only be called during event dispatch.

    Parameters

    • thenable: Thenable<any>

      A thenable that delays saving.

    Returns void

友链:VS Code 中文文档 | VS Code 官网文档 | VS Code 扩展市场

Generated by TypeDoc. Maintained by 洛竹