Skip to content

Commit

Permalink
adds a proposed API for keeping scroll position. ref #132068
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt committed Sep 1, 2021
1 parent c3f63dc commit ab8955c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ declare module 'vscode' {
*/
group?: string;

/**
/**
* Controls whether the terminal is closed after executing the task.
*/
close?: boolean;
Expand Down Expand Up @@ -1101,6 +1101,11 @@ declare module 'vscode' {
* An optional flag to sort the final results by index of first query match in label. Defaults to true.
*/
sortByLabel: boolean;

/*
* An optional flag that can be set to true to maintain the scroll position of the quick pick when the quick pick items are updated. Defaults to false.
*/
keepScrollPosition?: boolean;
}

//#endregion
Expand Down
10 changes: 10 additions & 0 deletions src/vs/workbench/api/common/extHostQuickOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
private _matchOnDescription = true;
private _matchOnDetail = true;
private _sortByLabel = true;
private _keepScrollPosition = false;
private _activeItems: T[] = [];
private readonly _onDidChangeActiveEmitter = new Emitter<T[]>();
private _selectedItems: T[] = [];
Expand Down Expand Up @@ -602,6 +603,15 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx
this.update({ sortByLabel });
}

get keepScrollPosition() {
return this._keepScrollPosition;
}

set keepScrollPosition(keepScrollPosition: boolean) {
this._keepScrollPosition = keepScrollPosition;
this.update({ keepScrollPosition });
}

get activeItems() {
return this._activeItems;
}
Expand Down

0 comments on commit ab8955c

Please sign in to comment.