Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Rieken <johannes.rieken@gmail.com>2022-07-19 16:47:57 +0300
committerGitHub <noreply@github.com>2022-07-19 16:47:57 +0300
commit44e25ba96e244b10b1021e04b392bc761ea61d62 (patch)
tree13f1135724989f5997bf18013f60d211193d6469 /src/vs/workbench/contrib/notebook/common
parent78693265be2fa394330df097c3fd99925dff21d4 (diff)
parent34f1bc679dadbd07104234ab03eacdd7b8d157f0 (diff)
Merge branch 'main' into joh/cellUri
Diffstat (limited to 'src/vs/workbench/contrib/notebook/common')
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookContextKeys.ts1
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookEditorInput.ts6
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.ts6
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookPerformance.ts36
4 files changed, 20 insertions, 29 deletions
diff --git a/src/vs/workbench/contrib/notebook/common/notebookContextKeys.ts b/src/vs/workbench/contrib/notebook/common/notebookContextKeys.ts
index e629ed034d2..fd9692eba0f 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookContextKeys.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookContextKeys.ts
@@ -24,6 +24,7 @@ export const NOTEBOOK_USE_CONSOLIDATED_OUTPUT_BUTTON = new RawContextKey<boolean
export const NOTEBOOK_BREAKPOINT_MARGIN_ACTIVE = new RawContextKey<boolean>('notebookBreakpointMargin', false);
export const NOTEBOOK_CELL_TOOLBAR_LOCATION = new RawContextKey<'left' | 'right' | 'hidden'>('notebookCellToolbarLocation', 'left');
export const NOTEBOOK_CURSOR_NAVIGATION_MODE = new RawContextKey<boolean>('notebookCursorNavigationMode', false);
+export const NOTEBOOK_LAST_CELL_FAILED = new RawContextKey<boolean>('notebookLastCellFailed', false);
// Cell keys
export const NOTEBOOK_VIEW_TYPE = new RawContextKey<string>('notebookType', undefined);
diff --git a/src/vs/workbench/contrib/notebook/common/notebookEditorInput.ts b/src/vs/workbench/contrib/notebook/common/notebookEditorInput.ts
index b8cbd4985d0..54e0ac40f5e 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookEditorInput.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookEditorInput.ts
@@ -16,7 +16,6 @@ import { IDisposable, IReference } from 'vs/base/common/lifecycle';
import { CellEditType, IResolvedNotebookEditorModel } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { ILabelService } from 'vs/platform/label/common/label';
import { Schemas } from 'vs/base/common/network';
-import { mark } from 'vs/workbench/contrib/notebook/common/notebookPerformance';
import { FileSystemProviderCapabilities, IFileService } from 'vs/platform/files/common/files';
import { AbstractResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
@@ -24,6 +23,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { VSBuffer } from 'vs/base/common/buffer';
import { IWorkingCopyIdentifier } from 'vs/workbench/services/workingCopy/common/workingCopy';
import { NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider';
+import { NotebookPerfMarks } from 'vs/workbench/contrib/notebook/common/notebookPerformance';
export interface NotebookEditorInputOptions {
startDirty?: boolean;
@@ -231,12 +231,12 @@ export class NotebookEditorInput extends AbstractResourceEditorInput {
}
}
- override async resolve(): Promise<IResolvedNotebookEditorModel | null> {
+ override async resolve(perf?: NotebookPerfMarks): Promise<IResolvedNotebookEditorModel | null> {
if (!await this._notebookService.canResolve(this.viewType)) {
return null;
}
- mark(this.resource, 'extensionActivated');
+ perf?.mark('extensionActivated');
// we are now loading the notebook and don't need to listen to
// "other" loading anymore
diff --git a/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.ts b/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.ts
index f6317245bb1..d1fbe75907f 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookExecutionStateService.ts
@@ -39,6 +39,10 @@ export interface ICellExecutionStateChangedEvent {
affectsCell(cell: URI): boolean;
affectsNotebook(notebook: URI): boolean;
}
+export interface INotebookFailStateChangedEvent {
+ failed: boolean;
+ notebook: URI;
+}
export const INotebookExecutionStateService = createDecorator<INotebookExecutionStateService>('INotebookExecutionStateService');
@@ -46,11 +50,13 @@ export interface INotebookExecutionStateService {
_serviceBrand: undefined;
onDidChangeCellExecution: Event<ICellExecutionStateChangedEvent>;
+ onDidChangeLastRunFailState: Event<INotebookFailStateChangedEvent>;
forceCancelNotebookExecutions(notebookUri: URI): void;
getCellExecutionStatesForNotebook(notebook: URI): INotebookCellExecution[];
getCellExecution(cellUri: URI): INotebookCellExecution | undefined;
createCellExecution(notebook: URI, cellHandle: number): INotebookCellExecution;
+ getLastFailedCellForNotebook(notebook: URI): number | undefined;
}
export interface INotebookCellExecution {
diff --git a/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts b/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts
index bd59c7bfbf1..c47b6eeeb2c 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookPerformance.ts
@@ -3,39 +3,23 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { URI } from 'vs/base/common/uri';
-
export type PerfName = 'startTime' | 'extensionActivated' | 'inputLoaded' | 'webviewCommLoaded' | 'customMarkdownLoaded' | 'editorLoaded';
type PerformanceMark = { [key in PerfName]?: number };
-const perfMarks = new Map<string, PerformanceMark>();
+export class NotebookPerfMarks {
+ private _marks: PerformanceMark = {};
+
+ get value(): PerformanceMark {
+ return { ...this._marks };
+ }
-export function mark(resource: URI, name: PerfName): void {
- const key = resource.toString();
- if (!perfMarks.has(key)) {
- const perfMark: PerformanceMark = {};
- perfMark[name] = Date.now();
- perfMarks.set(key, perfMark);
- } else {
- if (perfMarks.get(key)![name]) {
+ mark(name: PerfName): void {
+ if (this._marks[name]) {
console.error(`Skipping overwrite of notebook perf value: ${name}`);
return;
}
- perfMarks.get(key)![name] = Date.now();
- }
-}
-export function clearMarks(resource: URI): void {
- const key = resource.toString();
-
- perfMarks.delete(key);
-}
-
-export function getAndClearMarks(resource: URI): PerformanceMark | null {
- const key = resource.toString();
-
- const perfMark = perfMarks.get(key) || null;
- perfMarks.delete(key);
- return perfMark;
+ this._marks[name] = Date.now();
+ }
}