Ensure Active File is Highlighted in Books Viewlet (#9338)

* Add Reveal in Books editor tab context option

* Select item in books viewlet automatically

* changes

* easier than i thought it'd be

* Merge from Feat/create book

* Undo Merge from Feat/create book

* Use fsPath instead of path

* PR comments

* Fix tests

Co-authored-by: Maddy <12754347+MaddyDev@users.noreply.github.com>
This commit is contained in:
Chris LaFreniere
2020-03-05 23:43:22 -08:00
committed by GitHub
parent 34a7340a18
commit 0a9a0d3f46
10 changed files with 98 additions and 23 deletions

View File

@@ -54,6 +54,7 @@ import { find, firstIndex } from 'vs/base/common/arrays';
import { CodeCellComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/codeCell.component';
import { TextCellComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/textCell.component';
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
import { ICommandService } from 'vs/platform/commands/common/commands';
export const NOTEBOOK_SELECTOR: string = 'notebook-component';
@@ -102,7 +103,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
@Inject(ICapabilitiesService) private capabilitiesService: ICapabilitiesService,
@Inject(ITextFileService) private textFileService: ITextFileService,
@Inject(ILogService) private readonly logService: ILogService,
@Inject(ITelemetryService) private telemetryService: ITelemetryService
@Inject(ITelemetryService) private telemetryService: ITelemetryService,
@Inject(ICommandService) private commandService: ICommandService
) {
super();
this.updateProfile();
@@ -226,10 +228,10 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
private setScrollPosition(): void {
if (this._notebookParams && this._notebookParams.input) {
this._notebookParams.input.layoutChanged(() => {
this._register(this._notebookParams.input.layoutChanged(() => {
let containerElement = <HTMLElement>this.container.nativeElement;
containerElement.scrollTop = this._scrollTop;
});
}));
}
}
@@ -437,6 +439,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
this._navProvider = this.notebookService.getNavigationProvider(this._notebookParams.notebookUri);
if (this.contextKeyService.getContextKeyValue('bookOpened') && this._navProvider) {
// If there's a book opened but the current notebook isn't part of the book, this is a no-op
this.commandService.executeCommand('notebook.command.revealInBooksViewlet', this._notebookParams.notebookUri, false);
this._navProvider.getNavigation(this._notebookParams.notebookUri).then(result => {
this.navigationResult = result;
this.addButton(localize('previousButtonLabel', "< Previous"),