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
Fixes source control remember tree collapsed state #89313
Conversation
element = children[0]; | ||
|
||
if (element.incompressible) { | ||
let childElement: ICompressedTreeElement<T> = children[0]; | ||
if (childElement.incompressible) { | ||
break; | ||
} | ||
element = childElement; |
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.
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.
Fantastic find and fix!
This has been rotting for more than 8 months. |
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.
@jeanp413 Once again, fantastic work. Thanks a lot of keeping the changes up to date and for your patience! 🙏
Apart from the inline comments I found other issues:
- When using the tree view mode, new folders appeared as collapsed by default. For that reason I've changed the state to store collapsed folders, instead of expanded ones.
I've addressed my own feedback.
const storageMode = this.storageService.get(`scm.viewMode`, StorageScope.WORKSPACE) as ViewModelMode; | ||
let treeViewState: ITreeViewState | undefined; | ||
|
||
const raw = this.storageService.get(`scm.viewState`, StorageScope.WORKSPACE); |
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.
This breaks the scm.viewMode
key. Let's keep each state in its separate key.
element = children[0]; | ||
|
||
if (element.incompressible) { | ||
let childElement: ICompressedTreeElement<T> = children[0]; | ||
if (childElement.incompressible) { | ||
break; | ||
} | ||
element = childElement; |
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.
Fantastic find and fix!
@@ -783,6 +798,8 @@ class ViewModel { | |||
|
|||
configurationService.onDidChangeConfiguration(this.onDidChangeConfiguration, this, this.disposables); | |||
this.onDidChangeConfiguration(); | |||
|
|||
this.disposables.add(this.tree.onDidChangeCollapseState(() => this.updateViewState())); |
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.
This might be too expensive. We really only need to snapshot the view state whenever the view goes invisible or when the workbench shuts down.
This PR fixes #89145