An event that is fired when a {@link NotebookDocument notebook document} will be saved.
To make modifications to the document before it is being saved, call the {@linkcode NotebookDocumentWillSaveEvent.waitUntil waitUntil}-function with a thenable that resolves to a {@link WorkspaceEdit workspace edit}.
An event that is fired when a {@link NotebookDocument notebook document} will be saved.
To make modifications to the document before it is being saved, call the
{@linkcode NotebookDocumentWillSaveEvent.waitUntil waitUntil}-function with a thenable
that resolves to a {@link WorkspaceEdit workspace edit}.(notebook notebook-document-will-save-event)The {@link NotebookDocument notebook document} that will be saved.
Returns: NotebookDocument
The {@link NotebookDocument notebook document} that will be saved.
**Returns:** `NotebookDocument`(reason notebook-document-will-save-event)The reason why save was triggered.
Returns: TextDocumentSaveReason
The reason why save was triggered. **Returns:** `TextDocumentSaveReason`
(token notebook-document-will-save-event)A cancellation token.
Returns: CancellationToken
A cancellation token. **Returns:** `CancellationToken`
(wait-until notebook-document-will-save-event thenable)Allows to pause the event loop and to apply {@link WorkspaceEdit workspace edit}. Edits of subsequent calls to this function will be applied in order. The edits will be ignored if concurrent modifications of the notebook document happened.
Note: This function can only be called during event dispatch and not in an asynchronous manner:
workspace.onWillSaveNotebookDocument(event => {
// async, will *throw* an error
setTimeout(() => event.waitUntil(promise));
// sync, OK
event.waitUntil(promise);
})
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
Allows to pause the event loop and to apply {@link WorkspaceEdit workspace edit}.
Edits of subsequent calls to this function will be applied in order. The
edits will be *ignored* if concurrent modifications of the notebook document happened.
*Note:* This function can only be called during event dispatch and not
in an asynchronous manner:
```ts
workspace.onWillSaveNotebookDocument(event => {
// async, will *throw* an error
setTimeout(() => event.waitUntil(promise));
// sync, OK
event.waitUntil(promise);
})
```
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`cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |