diff --git a/src/polyglot-notebooks-vscode-insiders/package.json b/src/polyglot-notebooks-vscode-insiders/package.json index 841313ac65..e944c818d5 100644 --- a/src/polyglot-notebooks-vscode-insiders/package.json +++ b/src/polyglot-notebooks-vscode-insiders/package.json @@ -13,7 +13,7 @@ "//version": "The version '42.42.42' is auto-set during CI package creation.", "version": "42.42.42", "engines": { - "vscode": "1.77.0-insider" + "vscode": "1.78.0-insider" }, "bugs": { "url": "https://github.com/dotnet/interactive/issues" @@ -218,7 +218,7 @@ }, "dotnet-interactive.requiredInteractiveToolVersion": { "type": "string", - "default": "1.0.416504", + "default": "1.0.420401", "description": "The required version of the .NET Interactive tool." } } diff --git a/src/polyglot-notebooks-vscode-insiders/src/vscode.d.ts b/src/polyglot-notebooks-vscode-insiders/src/vscode.d.ts index 3b48f6a14f..6f8088e8ab 100644 --- a/src/polyglot-notebooks-vscode-insiders/src/vscode.d.ts +++ b/src/polyglot-notebooks-vscode-insiders/src/vscode.d.ts @@ -6499,7 +6499,7 @@ declare module 'vscode' { /** * Outputs the given trace message to the channel. Use this method to log verbose information. * - * The message is only loggeed if the channel is configured to display {@link LogLevel.Trace trace} log level. + * The message is only logged if the channel is configured to display {@link LogLevel.Trace trace} log level. * * @param message trace message to log */ @@ -6508,7 +6508,7 @@ declare module 'vscode' { /** * Outputs the given debug message to the channel. * - * The message is only loggeed if the channel is configured to display {@link LogLevel.Debug debug} log level or lower. + * The message is only logged if the channel is configured to display {@link LogLevel.Debug debug} log level or lower. * * @param message debug message to log */ @@ -6517,7 +6517,7 @@ declare module 'vscode' { /** * Outputs the given information message to the channel. * - * The message is only loggeed if the channel is configured to display {@link LogLevel.Info info} log level or lower. + * The message is only logged if the channel is configured to display {@link LogLevel.Info info} log level or lower. * * @param message info message to log */ @@ -6526,7 +6526,7 @@ declare module 'vscode' { /** * Outputs the given warning message to the channel. * - * The message is only loggeed if the channel is configured to display {@link LogLevel.Warning warning} log level or lower. + * The message is only logged if the channel is configured to display {@link LogLevel.Warning warning} log level or lower. * * @param message warning message to log */ @@ -6535,7 +6535,7 @@ declare module 'vscode' { /** * Outputs the given error or error message to the channel. * - * The message is only loggeed if the channel is configured to display {@link LogLevel.Error error} log level or lower. + * The message is only logged if the channel is configured to display {@link LogLevel.Error error} log level or lower. * * @param error Error or error message to log */ @@ -12489,6 +12489,21 @@ declare module 'vscode' { */ export const onDidChangeNotebookDocument: Event; + /** + * An event that is emitted when a {@link NotebookDocument notebook document} will be saved to disk. + * + * *Note 1:* Subscribers can delay saving by registering asynchronous work. For the sake of data integrity the editor + * might save without firing this event. For instance when shutting down with dirty files. + * + * *Note 2:* Subscribers are called sequentially and they can {@link NotebookDocumentWillSaveEvent.waitUntil delay} saving + * by registering asynchronous work. Protection against misbehaving listeners is implemented as such: + * * there is an overall time budget that all listeners share and if that is exhausted no further listener is called + * * listeners that take a long time or produce errors frequently will not be called anymore + * + * The current thresholds are 1.5 seconds as overall time budget and a listener can misbehave 3 times before being ignored. + */ + export const onWillSaveNotebookDocument: Event; + /** * An event that is emitted when a {@link NotebookDocument notebook} is saved. */ @@ -13558,6 +13573,61 @@ declare module 'vscode' { readonly cellChanges: readonly NotebookDocumentCellChange[]; } + /** + * 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}. + */ + export interface NotebookDocumentWillSaveEvent { + /** + * A cancellation token. + */ + readonly token: CancellationToken; + + /** + * The {@link NotebookDocument notebook document} that will be saved. + */ + readonly notebook: NotebookDocument; + + /** + * The reason why save was triggered. + */ + readonly reason: TextDocumentSaveReason; + + /** + * 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); + * }) + * ``` + * + * @param thenable A thenable that resolves to {@link WorkspaceEdit workspace edit}. + */ + waitUntil(thenable: Thenable): void; + + /** + * Allows to pause the event loop until the provided thenable resolved. + * + * *Note:* This function can only be called during event dispatch. + * + * @param thenable A thenable that delays saving. + */ + waitUntil(thenable: Thenable): void; + } + /** * The summary of a notebook cell execution. */ @@ -15946,6 +16016,13 @@ declare module 'vscode' { */ isDefault: boolean; + /** + * Whether this profile supports continuous running of requests. If so, + * then {@link TestRunRequest.continuous} may be set to `true`. Defaults + * to false. + */ + supportsContinuousRun: boolean; + /** * Associated tag for the profile. If this is set, only {@link TestItem} * instances with the same tag will be eligible to execute in this profile. @@ -15966,6 +16043,11 @@ declare module 'vscode' { * associated with the request should be created before the function returns * or the returned promise is resolved. * + * If {@link supportsContinuousRun} is set, then {@link TestRunRequest.continuous} + * may be `true`. In this case, the profile should observe changes to + * source code and create new test runs by calling {@link TestController.createTestRun}, + * until the cancellation is requested on the `token`. + * * @param request Request information for the test run. * @param cancellationToken Token that signals the used asked to abort the * test run. If cancellation is requested on this token, all {@link TestRun} @@ -16020,10 +16102,11 @@ declare module 'vscode' { * @param runHandler Function called to start a test run. * @param isDefault Whether this is the default action for its kind. * @param tag Profile test tag. + * @param supportsContinuousRun Whether the profile supports continuous running. * @returns An instance of a {@link TestRunProfile}, which is automatically * associated with this controller. */ - createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void, isDefault?: boolean, tag?: TestTag): TestRunProfile; + createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void, isDefault?: boolean, tag?: TestTag, supportsContinuousRun?: boolean): TestRunProfile; /** * A function provided by the extension that the editor may call to request @@ -16138,12 +16221,19 @@ declare module 'vscode' { */ readonly profile: TestRunProfile | undefined; + /** + * Whether the profile should run continuously as source code changes. Only + * relevant for profiles that set {@link TestRunProfile.supportsContinuousRun}. + */ + readonly continuous?: boolean; + /** * @param include Array of specific tests to run, or undefined to run all tests * @param exclude An array of tests to exclude from the run. * @param profile The run profile used for this request. + * @param continuous Whether to run tests continuously as source changes. */ - constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile); + constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean); } /** diff --git a/src/polyglot-notebooks-vscode/package.json b/src/polyglot-notebooks-vscode/package.json index 9303a1d80b..0c62953605 100644 --- a/src/polyglot-notebooks-vscode/package.json +++ b/src/polyglot-notebooks-vscode/package.json @@ -13,7 +13,7 @@ "//version": "The version '42.42.42' is auto-set during CI package creation.", "version": "42.42.42", "engines": { - "vscode": "^1.76.0" + "vscode": "^1.77.0" }, "bugs": { "url": "https://github.com/dotnet/interactive/issues" @@ -218,7 +218,7 @@ }, "dotnet-interactive.requiredInteractiveToolVersion": { "type": "string", - "default": "1.0.416502", + "default": "1.0.420401", "description": "The required version of the .NET Interactive tool." } } @@ -840,4 +840,4 @@ "vscode-textmate": "6.0.0", "vscode-uri": "3.0.6" } -} \ No newline at end of file +} diff --git a/src/polyglot-notebooks-vscode/src/vscode.d.ts b/src/polyglot-notebooks-vscode/src/vscode.d.ts index 7bdd9fefda..863434bb69 100644 --- a/src/polyglot-notebooks-vscode/src/vscode.d.ts +++ b/src/polyglot-notebooks-vscode/src/vscode.d.ts @@ -10481,6 +10481,7 @@ declare module 'vscode' { * Retrieves the data transfer item for a given mime type. * * @param mimeType The mime type to get the data transfer item for, such as `text/plain` or `image/png`. + * Mimes type look ups are case-insensitive. * * Special mime types: * - `text/uri-list` — A string with `toString()`ed Uris separated by `\r\n`. To specify a cursor position in the file, @@ -10490,7 +10491,8 @@ declare module 'vscode' { /** * Sets a mime type to data transfer item mapping. - * @param mimeType The mime type to set the data for. + * + * @param mimeType The mime type to set the data for. Mimes types stored in lower case, with case-insensitive looks up. * @param value The data transfer item for the given mime type. */ set(mimeType: string, value: DataTransferItem): void; @@ -12261,7 +12263,7 @@ declare module 'vscode' { * If you want to monitor file events across all opened workspace folders: * * ```ts - * vscode.workspace.createFileSystemWatcher('**​/*.js')); + * vscode.workspace.createFileSystemWatcher('**​/*.js'); * ``` * * *Note:* the array of workspace folders can be empty if no workspace is opened (empty window). @@ -15944,6 +15946,13 @@ declare module 'vscode' { */ isDefault: boolean; + /** + * Whether this profile supports continuous running of requests. If so, + * then {@link TestRunRequest.continuous} may be set to `true`. Defaults + * to false. + */ + supportsContinuousRun: boolean; + /** * Associated tag for the profile. If this is set, only {@link TestItem} * instances with the same tag will be eligible to execute in this profile. @@ -15964,6 +15973,11 @@ declare module 'vscode' { * associated with the request should be created before the function returns * or the returned promise is resolved. * + * If {@link supportsContinuousRun} is set, then {@link TestRunRequest.continuous} + * may be `true`. In this case, the profile should observe changes to + * source code and create new test runs by calling {@link TestController.createTestRun}, + * until the cancellation is requested on the `token`. + * * @param request Request information for the test run. * @param cancellationToken Token that signals the used asked to abort the * test run. If cancellation is requested on this token, all {@link TestRun} @@ -16018,10 +16032,11 @@ declare module 'vscode' { * @param runHandler Function called to start a test run. * @param isDefault Whether this is the default action for its kind. * @param tag Profile test tag. + * @param supportsContinuousRun Whether the profile supports continuous running. * @returns An instance of a {@link TestRunProfile}, which is automatically * associated with this controller. */ - createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void, isDefault?: boolean, tag?: TestTag): TestRunProfile; + createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable | void, isDefault?: boolean, tag?: TestTag, supportsContinuousRun?: boolean): TestRunProfile; /** * A function provided by the extension that the editor may call to request @@ -16136,12 +16151,19 @@ declare module 'vscode' { */ readonly profile: TestRunProfile | undefined; + /** + * Whether the profile should run continuously as source code changes. Only + * relevant for profiles that set {@link TestRunProfile.supportsContinuousRun}. + */ + readonly continuous?: boolean; + /** * @param include Array of specific tests to run, or undefined to run all tests * @param exclude An array of tests to exclude from the run. * @param profile The run profile used for this request. + * @param continuous Whether to run tests continuously as source changes. */ - constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile); + constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean); } /** @@ -16215,7 +16237,8 @@ declare module 'vscode' { /** * Appends raw output from the test runner. On the user's request, the * output will be displayed in a terminal. ANSI escape sequences, - * such as colors and text styles, are supported. + * such as colors and text styles, are supported. New lines must be given + * as CRLF (`\r\n`) rather than LF (`\n`). * * @param output Output text to append. * @param location Indicate that the output was logged at the given