Adjust the point where we switch from the cell progress bar to the editor progress bar (#178738)

* Adjust the point where we switch from the cell progress bar to the editor progress bar
Fix #178737

* Fix showing editor progress bar when insert toolbar is disabled

* Fix showing editor progress when moving the notebook editor between groups

* Add comment

---------

Co-authored-by: Eleanor Boyd <eleanorboyd@microsoft.com>
This commit is contained in:
Rob Lourens 2023-03-31 10:28:49 -07:00 committed by GitHub
parent b8a45b90b0
commit 829e0b3d06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View file

@ -38,6 +38,8 @@ export class ExecutionEditorProgressController extends Disposable implements INo
return;
}
const scrollPadding = this._notebookEditor.notebookOptions.computeTopInsertToolbarHeight(this._notebookEditor.textModel.viewType);
const executing = this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookEditor.textModel?.uri)
.filter(exe => exe.state === NotebookCellExecutionState.Executing);
const executionIsVisible = (exe: INotebookCellExecution) => {
@ -45,7 +47,7 @@ export class ExecutionEditorProgressController extends Disposable implements INo
for (const cell of this._notebookEditor.getCellsInRange(range)) {
if (cell.handle === exe.cellHandle) {
const top = this._notebookEditor.getAbsoluteTopOfElement(cell);
if (this._notebookEditor.scrollTop < top + 30) {
if (this._notebookEditor.scrollTop < top + scrollPadding + 5) {
return true;
}
}

View file

@ -38,6 +38,7 @@ import { NotebookPerfMarks } from 'vs/workbench/contrib/notebook/common/notebook
import { IEditorDropService } from 'vs/workbench/services/editor/browser/editorDropService';
import { GroupsOrder, IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
const NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'NotebookEditorViewState';
@ -76,7 +77,8 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
@INotebookEditorService private readonly _notebookWidgetService: INotebookEditorService,
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
@IFileService private readonly _fileService: IFileService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@IEditorProgressService private readonly _editorProgressService: IEditorProgressService,
) {
super(NotebookEditor.ID, telemetryService, themeService, storageService);
this._editorMemento = this.getEditorMemento<INotebookEditorViewState>(_editorGroupService, configurationService, NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY);
@ -231,7 +233,10 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane {
const viewState = options?.viewState ?? this._loadNotebookEditorViewState(input);
this._widget.value?.setParentContextKeyService(this._contextKeyService);
// We might be moving the notebook widget between groups, and these services are tied to the group
this._widget.value!.setParentContextKeyService(this._contextKeyService);
this._widget.value!.setEditorProgressService(this._editorProgressService);
await this._widget.value!.setModel(model.notebook, viewState, perf);
const isReadOnly = input.hasCapability(EditorInputCapabilities.Readonly);
await this._widget.value!.setOptions({ ...options, isReadOnly });

View file

@ -277,7 +277,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
@ITelemetryService private readonly telemetryService: ITelemetryService,
@INotebookExecutionService private readonly notebookExecutionService: INotebookExecutionService,
@INotebookExecutionStateService notebookExecutionStateService: INotebookExecutionStateService,
@IEditorProgressService private readonly editorProgressService: IEditorProgressService,
@IEditorProgressService private editorProgressService: IEditorProgressService,
@INotebookLoggingService readonly logService: INotebookLoggingService,
) {
super();
@ -1037,6 +1037,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
return this._webview?.webview;
}
setEditorProgressService(editorProgressService: IEditorProgressService): void {
this.editorProgressService = editorProgressService;
}
setParentContextKeyService(parentContextKeyService: IContextKeyService): void {
this.scopedContextKeyService.updateParent(parentContextKeyService);
}