Skip to content

Commit

Permalink
Improve runtime session service stability (#5380)
Browse files Browse the repository at this point in the history
The aim of this PR is to improve the stability of the runtime session
service, with a slight focus on notebooks.

This is another step toward
#2671.

I've also added an extensive suite of unit tests for the runtime session
service, for two reasons:

1. Some of the issues we're seeing with notebooks are intermittent and
therefore tricky to reproduce without tests.
2. I wanted to ensure that I didn't break any existing behavior with
these changes as well as more planned changes to add notebook-runtime
methods to the extension API.
  • Loading branch information
seeM authored Nov 28, 2024
1 parent 9598da7 commit a36f4d7
Show file tree
Hide file tree
Showing 8 changed files with 1,168 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,19 @@ function executeCode(
}
}
}).catch(error => {
// Stop listening for replies.
handler.dispose();

// Reject the outer execution promise since we've encountered an error.
reject(error);

// Rethrow the error to stop any replies that are chained to this promise.
throw error;
});

// Avoid unhandled rejections being logged to the console.
// The actual error-handling is in the catch block above.
currentMessagePromise.catch(() => { });
});

// Execute the cell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ import { ViewContainer, IViewContainersRegistry, ViewContainerLocation, Extensio
import { registerAction2 } from 'vs/platform/actions/common/actions';
import { PositronOpenUrlInViewerAction } from 'vs/workbench/contrib/positronPreview/browser/positronPreviewActions';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope, } from 'vs/platform/configuration/common/configurationRegistry';
import { POSITRON_PREVIEW_PLOTS_IN_VIEWER } from 'vs/workbench/services/languageRuntime/common/languageRuntimeUiClient';

// The Positron preview view icon.
const positronPreviewViewIcon = registerIcon('positron-preview-view-icon', Codicon.positronPreviewView, nls.localize('positronPreviewViewIcon', 'View icon of the Positron preview view.'));

export const POSITRON_PREVIEW_PLOTS_IN_VIEWER = 'positron.viewer.interactivePlotsInViewer';

// Register the Positron preview container.
const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
id: POSITRON_PREVIEW_VIEW_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { URI } from 'vs/base/common/uri';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { ILogService } from 'vs/platform/log/common/log';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { POSITRON_PREVIEW_PLOTS_IN_VIEWER } from 'vs/workbench/contrib/positronPreview/browser/positronPreview.contribution';

export const POSITRON_PREVIEW_PLOTS_IN_VIEWER = 'positron.viewer.interactivePlotsInViewer';

/**
* The types of messages that can be sent to the backend.
Expand Down
355 changes: 266 additions & 89 deletions src/vs/workbench/services/runtimeSession/common/runtimeSession.ts

Large diffs are not rendered by default.

Loading

0 comments on commit a36f4d7

Please sign in to comment.