![]() ![]() ![]() The cancellation token is usually the last parameter of a function call and optional. For instance, computing IntelliSense starts and the user continues to type making the result of that operation obsolete.ĪPIs that are exposed to such behavior will get passed a CancellationToken on which you can check for cancellation ( isCancellationRequested) or get notified when cancellation occurs ( onCancellationRequested). Often operations are started on volatile state which changes before operations can finish. When the use of a promise is optional, the API indicates this by returning or-types. In most cases the use of promises is optional and when VS Code calls into an extension, it can handle the result type as well as a Thenable of the result type. From extensions any type of promise can be returned, like ES6, WinJS, A+, etc.īeing independent of a specific promise library is expressed in the API by the Thenable-type. The VS Code API represents asynchronous operations with promises. The extension API of Visual Studio Code follows some guiding patterns and principles which are applied throughout the whole API.
0 Comments
Leave a Reply. |