-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Allow tabs to wrap to multi-line #106448
Allow tabs to wrap to multi-line #106448
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.
@sneakyfish5 kudos, this is a very elegant solution given it only requires CSS changes 👍
Some feedback after a quick review:
- can we expose the setting from
IEditorPartConfiguration
? This should make it much easier to read the setting and react to changes (e.g. fromthis._register(this.accessor.onDidEditorPartOptionsChange(e => { - the color introduced for the border needs to be themable (i.e. cannot be hardcoded in the CSS) and needs some testing together with the existing tab border colors that we have, I am not sure it will work in all cases
- when tabs wrap they do not align nicely below the editor action bar (see screenshot below), can we possibly improve this?
- there seems to be a bug when trying to drop a tab after the last tab, the drop feedback spans multiple rows (see video below)
Most of the CSS work was done by people in the original issue; I just pieced it together into a setting, so huge props to them 😃
Done
Done, I used
I think a neat solution for both of these problems is provided by @fraigo in #70413 (comment), let me know what you think. Here's a visual representation of it included with all the other changes: Otherwise, setting a |
d9b6152
to
8139024
Compare
This looks very similar to |
@bpasero @sneakyfish5 One solution to make the last row use the space better is adding a 'hidden' flex space after the last tab (in this case, adding space at the end of the tab container. I think
|
After some digging as well I couldn't figure out how to make the tabs stay the same size and align properly at the very far end, aside from setting a |
yes @sneakyfish5, using |
Awesome, recorded a little snippet here: @bpasero is that better? |
@sneakyfish5 can you add this solution to this PR for me to play with? Easier then to give some feedback. I will also comment on the tab border then, thanks 👍 |
Will do 👍 |
@sneakyfish5 this works great when many tabs are opened and it wraps but is there a way to not have excessively large tabs when you only have few opened: ? |
I pushed a few polish changes to your branch and thought about the use of border: I think conceptually it makes a lot of sense to use However, I think the logic of drawing this border should merge with the existing border we already have for active tabs which also draws a border below tabs: vscode/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts Lines 1150 to 1156 in 9dc00c6
This ensures we are using the same logic for rendering a border and more importantly allows to still have a different border color for the active tab compared to others. |
That's the current issue I'm facing that I'm not sure how to solve. I've tried setting a
Done, it now only draws a bottom-border for inactive tabs when multi-line tabs are enabled. Is that what you meant? The commits got a little messy there (sorry about that), but I've fixed merge conflicts and changed it to use |
@sneakyfish5 one thing we could maybe try is to do the flex trick conditionally depending on wether the tabs wrap or not? E.g. when you open only a few tabs they would appear normally and only when they wrap we start the trick? Code wise we know exactly how much space we have and how much space tabs consume around here:
So we could toggle a similar class depending on how much space tabs consume in the tab container? |
That's definitely possible, I've made it so that the multi-line tabs class only added if the "all tabs width" is greater than the "visible tabs width", and is removed if they are equal and the container height is equal to I agree this probably isn't the most optimal situation and that it would be preferable to have the tabs be somewhat the same size and also expand to fill the container at the end of the row, but I'm not sure how to accomplish that. |
@@ -501,6 +502,10 @@ class DropOverlay extends Themable { | |||
|
|||
private getOverlayOffsetHeight(): number { | |||
if (!this.groupView.isEmpty && this.accessor.partOptions.showTabs) { | |||
const tablist = document.querySelector(DropOverlay.TABS_SELECTOR) as HTMLElement; |
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 will not work properly once you have more than one editor group opened because then you will have more than one div.tabs-container
.
I suggest an alternate solution where the accessor
provides a method to ask for the height of the editor title area. The accessor
in this case is the EditorPart
which can delegate this to the group in question and then the group can forward this to the title control. And I would only use the offsetHeight
property if mutli-line tabs are enabled.
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.
Done, please let me know if I've done this incorrectly.
@@ -1174,6 +1188,10 @@ export class TabsTitleControl extends TitleControl { | |||
tabContainer.style.backgroundColor = this.getColor(isGroupActive ? TAB_INACTIVE_BACKGROUND : TAB_UNFOCUSED_INACTIVE_BACKGROUND) || ''; | |||
tabContainer.style.boxShadow = ''; | |||
|
|||
// bottom border when wrapping multi-line |
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.
My suggestion was to reuse the tab-border-bottom
helper for this case too and not introduce yet another border. Currently the tab-border-bottom
is reserved for active tabs because the border was only used for active tabs, but to ensure we get a consistent look, we should be using the same thing for the separator as well. Otherwise we end up with an active border that is not on the exact same line as the separator border.
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.
Done, I misunderstood what you suggested earlier but hopefully it's correct now?
Actually with a53fe3c found a nice solution via CSS variables that does not require to patch any tab element directly. This makes sure we only have a I think this PR is close to be done, I would appreciate some testing so that we are certain this works as intended. |
This is the PR I have been waiting for for years. Is there any way I can help get this merged faster? :) |
Hey, sorry again I've been very busy recently. Thank you so much @bpasero for pushing all those fixes. @cullenjohnson maybe you can help with the testing outlined here, or just in general do any sort of testing that you can think of? If not no worries, I'll be able to get some testing done within the next day or so as well, but of course all help is appreciated. |
Hi,
I am up for testing but where will I get a version to test. Donot have
development environment to build myself.
I need a Mac version btw.
Thanks,
Swinder
…On Wed, Dec 30, 2020, 12:51 PM SneakyFish5 ***@***.***> wrote:
Hey, sorry again I've been very busy recently. Thank you so much @bpasero
<https://github.com/bpasero> for pushing all those fixes.
@cullenjohnson <https://github.com/cullenjohnson> maybe you can help with
the testing outlined here
<#106448 (comment)>,
or just in general do any sort of testing that you can think of? If not no
worries, I'll be able to get some testing done within the next day or so as
well, but of course all help is appreciated.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#106448 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADBBZ3QINBMPYNUEI2DSZDSXLIIFANCNFSM4RGQAQ6A>
.
|
Sorry for the delay again, had a lot of issues with
I also tested a few more things that I can't quite remember now, however they all worked, and everything looked good in regards to the editor height and layout. If there are any more tests that need to be completed, please let me know. |
Thanks a lot @sneakyfish5 I plan to merge this soon to get it into insiders during January for more coverage. |
Thanks @sneakyfish5 for pushing this forward 🥂 |
This issue seems to be merged now - Am I right? |
@Tschebbe if you don't want to wait until your next stable release in early February, simply switch to VSCode insiders to get this as early as tomorrow: https://code.visualstudio.com/insiders/ |
Thank you as well @bpasero for your continuous effort and assistance in pushing this PR forward! |
I think I found a pure css solution for the problem with last tab spanning the whole width!
This will create an additional tab pseudo-element, that grows 20 times larger than the other tabs. It could be an even higher number, but I think 20 should be sufficient. |
@DynDux @sneakyfish5 great, I suggest we take this idea to a new PR and test it out there, what do you think? |
Totally ok for me! Just thought it belongs to this PR because this is how it should have been resolved in first place. ;-) |
I have added your suggested solution to #113801. |
Great work to those involved! Pumped to have this feature 👏 🎉 👏 |
This PR fixes #70413