Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions extensions/positron-python/src/client/positron/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,21 @@ export class PythonLsp implements vscode.Disposable {
this._outputChannel.appendLine('Waiting for client to initialize before stopping');
await this._initializing;

// Suppress the "Connection to server got closed" toast that
// vscode-languageclient force-shows when the connection close races
// with `stop()`: if the socket close handler fires while `$state ===
// Stopping` (between `connection.dispose()` and the `finally` block
// in `shutdown()`), our `PythonErrorHandler.closed()` is bypassed and
// the notification is forced. See posit-dev/positron#7593.
const origError = this._client.error.bind(this._client);
this._client.error = (message, data, showNotification) => {
if (typeof message === 'string' && /Connection to server got closed/.test(message)) {
origError(message, data, false);
return;
}
origError(message, data, showNotification);
};

// Ideally we'd just wait for `this._client!.stop()`. In practice, the
// promise returned by `stop()` never resolves if the server side is
// disconnected, so rather than awaiting it when the runtime has exited,
Expand Down
15 changes: 15 additions & 0 deletions extensions/positron-r/src/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,21 @@ export class ArkLsp implements vscode.Disposable {
// partially initialized client.
await this._initializing;

// Suppress the "Connection to server got closed" toast that
// vscode-languageclient force-shows when the connection close races
// with `stop()`: if the socket close handler fires while `$state ===
// Stopping` (between `connection.dispose()` and the `finally` block
// in `shutdown()`), our `RErrorHandler.closed()` is bypassed and the
// notification is forced. See posit-dev/positron#7593.
const origError = this.client.error.bind(this.client);
this.client.error = (message, data, showNotification) => {
if (typeof message === 'string' && /Connection to server got closed/.test(message)) {
origError(message, data, false);
return;
}
origError(message, data, showNotification);
};

// Ideally we'd just wait for `this._client!.stop()`. In practice, the
// promise returned by `stop()` never resolves if the server side is
// disconnected, so rather than awaiting it when the runtime has exited,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ test.describe('Positron Notebooks: Kernel Behavior', {
});
});

test.skip('ensure existing notebooks use their correct interpreter kernel',
{
annotation: [{ type: 'issue', description: 'https://github.com/posit-dev/positron/issues/7593' }] // <--- test is failing on chromium only
},
test('ensure existing notebooks use their correct interpreter kernel',
async function ({ app, sessions }) {
const { notebooksPositron } = app.workbench;
const pythonNotebook = path.join('workspaces', 'data-explorer-update-datasets', 'pandas-update-dataframe.ipynb');
Expand Down
Loading