Skip to content

Conversation

@goldst
Copy link
Contributor

@goldst goldst commented Feb 9, 2021

This PR fixes #110694

Diff editors can have a tab label that is too long in some cases. This PR implements the ability for tabs to have multiple labels, each with separate code icons and shortened paths, and makes use of that for diff editors.

The alternative to this would be to just shorten the paths but keeping the current way of labeling. I have implemented that as well. See #110694 and master...goldst:shorten-diff-title-A for details.

Test this by opening two files with the same name but different paths, then ctrl+shift+p -> compare active file with...

Overview of the most important changes from a technical point of view:

  • add getNames and getDescriptions to IEditorInput so editors can have one or multiple labels. Implement these in EditorInput where they return the name and description, and override them in DiffEditorInput to return all three labels (left editor, compare arrow, right editor)
  • change the logic for rendering tabs:
    • tabTitleControl.ts gets all names and descriptions and shortens paths even when there are multiple paths in one label
    • add some classes in label.ts (eg MultipleResourceLabels and ResourceLabelWidgets) that have mostly the same methods as the ones previously in use, but they are a wrapper for multiple objects of the previous classes. Also added some interfaces/parent classes (eg IResourceLabels, IResourceLabelWidget and ResourceLabelGroupBase) to make sure they behave in the same way as the ones used previously.

This PR might have some implications that weren't clear to me, that's why I suggest that it should be reviewed thoroughly. I would also like to have a general yes or no for this approach before I/we fix the merge conflicts.

@bpasero bpasero added this to the Backlog milestone Feb 9, 2021
@bpasero bpasero marked this pull request as draft February 9, 2021 15:52
@goldst
Copy link
Contributor Author

goldst commented Feb 12, 2021

@bpasero The checks are "expected" now for a long time. Can you check what's causing the problem?

@joaomoreno joaomoreno changed the base branch from master to main February 15, 2021 08:51
@bpasero
Copy link
Member

bpasero commented Feb 19, 2021

Thanks for the PR, sorry for the late reply. A little bit on the expectation: I will probably not have time to review this until we get to our yearly issue grooming iteration in October.

@goldst
Copy link
Contributor Author

goldst commented Feb 19, 2021

I see. That is a bit unfortunate because there will probably be more merge conflicts then, but nevertheless, I'll ping you and probably be available for fixing them in October.

@goldst
Copy link
Contributor Author

goldst commented Sep 20, 2021

I'll close this due to the discussion in #110694 and @bpasero's recent commit which solves the same issue.

@goldst goldst closed this Sep 20, 2021
@bpasero bpasero modified the milestones: Backlog, September 2021 Sep 21, 2021
@bpasero
Copy link
Member

bpasero commented Sep 21, 2021

@goldst thanks and sorry for not accepting this PR. Nevertheless I will make sure that your contribution appears in our "Thank You" section for our upcoming 1.61 release (similar to https://code.visualstudio.com/updates/v1_60#_thank-you)

@github-actions github-actions bot locked and limited conversation to collaborators Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to shorten the diff editor title

2 participants