-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add sash option for widget resize #10441
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 noticed that there is a flicker when resizing with the sash
, something which is not present in vscode and can likely be improved upon:
theia:
sash-flicker.mp4
vscode:
sash-flicker-vscode.mp4
Also, I noticed on startup that the sash is quite small (I never updated the preference value), and then it becomes bigger later, perhaps something to try out for yourself.
'workbench.sash.hoverDelay': { | ||
type: 'number', | ||
default: 1, | ||
minimum: 1, | ||
maximum: 2000, | ||
description: nls.localizeByDefault('Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.') | ||
}, | ||
'workbench.sash.size': { | ||
type: 'number', | ||
default: 7, | ||
minimum: 1, | ||
maximum: 20, | ||
description: nls.localizeByDefault('Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if needed.') | ||
}, |
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.
Any reason we do not want to use the same values and defaults as in vscode?
'workbench.sash.size': {
type: 'number',
default: isIOS ? 20 : 4,
minimum: 1,
maximum: 20,
description: localize('sashSize', "Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if you feel it's hard to resize views using the mouse.")
},
'workbench.sash.hoverDelay': {
type: 'number',
default: 300,
minimum: 0,
maximum: 2000,
description: localize('sashHoverDelay', "Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.")
},
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.
@vince-fugnitto I have updated the values and defaults to align with the behavior present in vscode.
I kept the default value for sash.hoverDelay
to be 0 because it would be a more straightforward solution for the resizing latency issue mentioned in #10416.
@vince-fugnitto Thanks for the feedback!
I have pushed up changes that should remove the flicker when resizing the sash-option.mov
After some testings, I noticed a bug with my previous change. When an editor widget is focused, the sash size becomes smaller by a certain ratio (compared to when the left panel is in focused). When the left panel gains focus again, the sash size increases to the value defined in the preference. This bug is fixed in the latest commit. |
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.
@kaiyue0329, for some reason GitHub isn't letting me reply to our existing conversation, but one way to manage a dynamic style element would be like this. That would give you a central location to update the value, rather than requiring you to iterate through all of the individual elements.
I also notice that in VSCode, the hover shows in between groups if you have multiple editor groups, but that doesn't appear to be the case with this code:
Thank you @colin-grant-work! I have pushed changes that address your comments. I also updated the screencast in the PR description to include the procedure for testing |
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 seems like the flickering Vince experienced on Chrome is fixed. However, it still exists on Firefox:
2021-11-25.12-44-42.mp4
@kaiyue0329 looking really nice so far. I noticed one small functionality issue:
|
@msujew Thank you for the feedback. I have pushed up changes that should remove the flickering in Firefox. |
@kenneth-marut-work Thank you for the feedback. I have made changes to the code so that a sash in the left panel only appears under certain conditions (please see the updated PR description for more details). |
@vince-fugnitto @colin-grant-work This PR is ready for another round of review. |
@vince-fugnitto points out that there are already some reasonable utilities for creating and manipulating dynamic style sheets here. Would you be interested in taking that code and moving it to |
@colin-grant-work Yes, I will do that! |
packages/editor/src/browser/decorations/editor-decoration-style.ts
Outdated
Show resolved
Hide resolved
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.
@kaiyue0329 once you've addressed the remaining comments I'll give this another test to make sure the functionality is in place and there are no issues. I think the EditorDecorationStyle
class & DecorationStyle
namespace could benefit from some refactoring after this is merged since it's a bit hard to follow. But that's outside the scope of this PR.
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.
The sash functionality is working well in the contexts where it's expected to appear, and the problems with the git decorations and odd sash appearance have been resolved.
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've tested this again and confirm that it's working as expected and confirmed that the blame CSS regressions have been fixed as well as the theming issue
- Apply focus to a widget handle when you hover over it - 'sash.hoverDelay' preference controls the hover feedback delay in milliseconds - 'sash.size' preference controls the feedback area size in pixels for the dragging area - Refactor the code for creating and manipulating dynamic stylesheets Signed-off-by: Kaiyue Pan <kaiyue.pan@ericsson.com>
What it does
Fixes #10416
sash-option.mov
sash.hoverDelay
controls the hover feedback delay in millisecondssash.size
controls the feedback area size in pixels for the dragging areaeditor-decoration-style.ts
todecoration-style.ts
incore
so that:1. the active
horizontal
container is expanded2. the container that is above/below the active
horizontal
container is also expandedactive-container-collapsed.mov
all-collapsed.mov
How to test
(please refer to the screencast above for more details)
sash.hoverDelay
andsash.size
preferences to valid valuesReview checklist
Reminder for reviewers
Signed-off-by: Kaiyue Pan kaiyue.pan@ericsson.com