-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reset scroll position core #132013
reset scroll position core #132013
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only looked at pickerQuickAccess.ts
@@ -1411,10 +1435,13 @@ export class QuickInputController extends Disposable { | |||
const items = input.items.slice(); | |||
const removed = items.splice(index, 1); | |||
const activeItems = input.activeItems.filter((ai) => ai !== removed[0]); | |||
const resetScrollPositionBefore = input.resetScrollPosition; | |||
input.resetScrollPosition = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still resets when you remove the item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because all it's doing is setting items
which triggers an update
which triggers the reset of the scroll position.
@@ -362,6 +362,14 @@ export class QuickInputList { | |||
return Event.map(this.list.onDidChangeSelection, e => ({ items: e.elements.map(e => e.item), event: e.browserEvent })); | |||
} | |||
|
|||
get scrollTop() { | |||
return this.list.scrollTop; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure about the list-widget but for the tree there is getViewState
which captured scroll position and selection. I happily use that for the outline when switching between editors - might be an option for the list too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see a getViewState
equivalent in my look around the list-widget but good to know!
@@ -289,6 +289,8 @@ export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput { | |||
|
|||
autoFocusOnList: boolean; | |||
|
|||
resetScrollPosition: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the API, I would turn this around because default values are never true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flipped it around and called it keepScrollPosition: boolean
Adds a new property to quick picks called:
resetScrollPosition: boolean
which defaults to
true
that controls whether or not the cursor position will be reset to the top when either
items
oractiveItems
are changed.This PR fixes #109969