Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

The behavior seems different that what is described in the documentation #27

Open
piotr-dobrogost opened this issue May 9, 2022 · 1 comment

Comments

@piotr-dobrogost
Copy link

piotr-dobrogost commented May 9, 2022

Firstly, thank you very much for creating this very useful plugin!

It seems I can't get the plugin to work.
I have Max number of dirs to show set to 2 and Count from start unchecked.

Having the following 3 files in the project

piotr@host:~project_dir$ find . -name 'some_file.py'
./project_name/resources/settings/agreements/modify/tests/some_file.py
./project_name/resources/transactions/cards/create/tests/some_file.py
./project_name/services/backend/tests/some_file.py

their tabs are named like this:

resources|settings some_file.py
resources|transactions some_file.py
services some_file.py

whereas I would expect (according to the documentation) this:

agreements|modify some_file.py
cards|create some_file.py
services|backend some_file.py

I'm using updated version of the plugin from https://github.com/vlascik/Tabdir/releases/tag/release-1.6.7-mod-vl with
PyCharm 2021.3.2 (Professional Edition)
Build #PY-213.6777.50, built on January 27, 2022

Thank you in advance for helping me getting this to work.

Btw, there's the issue "Show directory on editor tabs" at https://youtrack.jetbrains.com/issue/IDEA-111624 with users begging for improvement in this area and JetBrains keeps saying "sorry, will not do anything".

@crazyproger
Copy link
Owner

Hi @piotr-dobrogost, thank you for response!
I see that settings is non-userfriendly right now.
Let me explain algorithm and my thoughts when I was implementing it.
Firstly, the main idea here is to show smth short and at the same time maximally uniq on each file tab, and not show anything extra(due to tab size is critical, especially in Java* world where classes could be VeryVeryFactoryInterfaceFacade long).
Current algorithm always starts to find differences from left part of full path(/), because it is always common prefix.
Then, when we found enough differences in path to uniquely identify file - it stops.
For your case:

(1) ./project_name/resources/settings/agreements/modify/tests/some_file.py
(2) ./project_name/resources/transactions/cards/create/tests/some_file.py
(3) ./project_name/services/backend/tests/some_file.py

We have:

  1. [resources, settings]
  2. [resources, transactions]
  3. [services]
    And nothing else, main idea is that: if we have [resources, settings] - we 100% sure that this is ./project_name/resources/settings/agreements/modify/tests/some_file.py because under settings there is no other some_file.py
    And thats why Count from start in your case does nothing - max lengths of all arrays is 2, which in your case equivalent to opposite setting.
    If you add file /project_name/resources/settings/agreements/another/tests/some_file.py - you will see
settings|modify some_file.py
settings|another some_file.py
resources|transactions some_file.py
services some_file.py

At the moment when I was implementing this I tried lots of variants(sadly, but it was long time ago - can't remember exact which variants I've tried). I've stopped on this simple one, because other was also non-obvious, and I didn't find general way for all use cases - for some people this variant is OK, for some - opposite.

If you have better idea of an algorithm - please, describe it(with examples).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants