Skip to content
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

Fixed #4897: supported tab details to disambiguate identical names #5775

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

fangnx
Copy link

@fangnx fangnx commented Jul 22, 2019

What it does

Fixed #4897.

  • Supported additional tab details for tabs with identical titles.
  • If there existed multiple tabs with the same name, each tab would have its partial relative path displayed after the title.
    image

How to test

  • Open files with identical names in a tab bar (e.g., index.ts from different directories), and they should have a partial path displayed for the purpose of disambiguation.

Review checklist

Reminder for reviewers

@vince-fugnitto vince-fugnitto added editor issues related to the editor enhancement issues that are enhancements to current functionality - nice to haves labels Jul 22, 2019
@vince-fugnitto
Copy link
Member

vince-fugnitto commented Aug 9, 2019

Is this the intended behavior?
I don't get any distinction between identical file names in different main-area groups.
I see that VSCode does something similar, but shouldn't we be better in this case? It'd be a lot easier to identify identical file names regardless of where they are situated in the main area.

Screen Shot 2019-08-09 at 2 25 49 PM

Maybe a second opinion would be good.

@fangnx
Copy link
Author

fangnx commented Aug 9, 2019

Is this the intended behavior?
I don't get any distinction between identical file names in different main-area groups.
I see that VSCode does something similar, but shouldn't we be better in this case? It'd be a lot easier to identify identical file names regardless of where they are situated in the main area.

Screen Shot 2019-08-09 at 2 25 49 PM Maybe a second opinion would be good.

Yes, this is the intended behaviour when I implemented it. The code is in TabBarRenderer and it is only possible to get editors present in one specific tab bar. I did not find a way (and the appropriate place) to merge editors from all tab bars and parse them, so I decided to do what VS Code has for now.

@vince-fugnitto
Copy link
Member

Yes, this is the intended behaviour when I implemented it. The code is in TabBarRenderer and it is only possible to get editors present in one specific tab bar. I did not find a way (and the appropriate place) to merge editors from all tab bars and parse them, so I decided to do what VS Code has for now.

That sounds fine, I'm fine with having the same behavior as VSCode as well :)
I think it can be a future enhancement to also allow the functionality irregardless of the main panel groups.

expect(pathMap.get(tabPaths[4])).to.be.equal('root1/aaa/bbb');
expect(pathMap.get(tabPaths[5])).to.be.equal('.../ccc');
// tslint:disable-next-line: no-unused-expression
expect(pathMap.get(tabPaths[6])).to.be.undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid the suppression of the tslint check by updating the code from:

expect(pathMap.get(tabPaths[6])).to.be.undefined;

To:

expect(pathMap.get(tabPaths[6])).to.be.equal(undefined);

import { TabBarRenderer } from './tab-bars';

describe('tab-bar', () => {
describe('tab-name-disambiguation', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@lmcbout
Copy link
Contributor

lmcbout commented Aug 14, 2019

I open a multi-root workspace and I have the following file in each root folder:

  • root1/.theia/tasks.json
  • root2/.theia/tasks.json

Both are reported as : .theia/tasks.json
There is no distinction when I open the same file from two differents roots

@fangnx
Copy link
Author

fangnx commented Aug 14, 2019

I open a multi-root workspace and I have the following file in each root folder:

  • root1/.theia/tasks.json
  • root2/.theia/tasks.json

Both are reported as : .theia/tasks.json
There is no distinction when I open the same file from two differents roots

Thanks for the feedback! I will test it and then address this issue

@fangnx
Copy link
Author

fangnx commented Aug 14, 2019

I open a multi-root workspace and I have the following file in each root folder:

  • root1/.theia/tasks.json
  • root2/.theia/tasks.json

Both are reported as : .theia/tasks.json
There is no distinction when I open the same file from two differents roots

I just rebased the PR to the latest master. Please let me know if it still does not work (it works on my side) ;)

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments
The test does not execute
Otherwise, code + execution looks nice, works well

@vince-fugnitto
Copy link
Member

vince-fugnitto commented Aug 15, 2019

@fangnx in order to fix the test:

import { enableJSDOM } from '../test/jsdom';
let disableJSDOM = enableJSDOM();

import { expect } from 'chai';
import { Title, Widget } from '@phosphor/widgets';
import { TabBarRenderer } from './tab-bars';

disableJSDOM();

describe('tab bar', () => {

    before(() => {
        disableJSDOM = enableJSDOM();
    });

    after(() => {
        disableJSDOM();
    });

    ...

We need to make sure to clean up after testing due to enableJSDOM.

@fangnx fangnx force-pushed the fnx-fix-4897 branch 2 times, most recently from 7f222bd to 8a6cae4 Compare August 15, 2019 15:05
…ical names

- Supported additional tab details for tabs with identical titles.
- If there existed multiple tabs with the same name, each tab would have its partial relative path displayed after the title.

Signed-off-by: fangnx <[email protected]>
@vince-fugnitto
Copy link
Member

@lmcbout do you mind completing the review and merging if it's fine?

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Nice works @fangnx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor issues related to the editor enhancement issues that are enhancements to current functionality - nice to haves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tab-bar][editor] Support tab details to disambiguate editor titles
4 participants