Conversation
There was a problem hiding this comment.
@hun1ahpu this is cool, thanks. I gave some feedback in the code.
Also I ran a test quickly and wonder about this situation:
In particular:
- first
loader.jsis insidequnit.1/qunit - second
loader.jsis insidequnit.1 - third
loader.jsis insidequnit
I find the first and second tab now hard to distinguish, shouldn't the full path be shown in this case?
src/vs/base/common/paths.ts
Outdated
| * Every shorten path matches only one original path and vice versa. | ||
| */ | ||
| export function shorten(paths: string[]): string[] { | ||
| var separator = isWindows ? '\\' : '/'; |
There was a problem hiding this comment.
Suggest to use paths.nativeSep here (https://github.com/Microsoft/vscode/blob/master/src/vs/base/common/paths.ts#L20)
| import { isLinux, isWindows } from 'vs/base/common/platform'; | ||
| import { fill } from 'vs/base/common/arrays'; | ||
| import { CharCode } from 'vs/base/common/charCode'; | ||
| import { endsWith } from 'vs/base/common/strings'; |
There was a problem hiding this comment.
Overall, can you please use const and let instead of var for variables?
src/vs/base/common/paths.ts
Outdated
| */ | ||
| export function shorten(paths: string[]): string[] { | ||
| var separator = isWindows ? '\\' : '/'; | ||
| var ellipsis = '...'; |
There was a problem hiding this comment.
How about using the actual unicode ellipsis character? I think that will save us some pixels (e.g. http://www.fileformat.info/info/unicode/char/2026/index.htm)
|
@bpasero Thank you for your comments. I've resolved comments in the code. |
| import { fill } from 'vs/base/common/arrays'; | ||
| import { rtrim } from 'vs/base/common/strings'; | ||
| import { CharCode } from 'vs/base/common/charCode'; | ||
| import { endsWith } from 'vs/base/common/strings'; |
There was a problem hiding this comment.
| labelDuplicates.forEach(duplicates => { | ||
| if (duplicates.length > 1) { | ||
| duplicates.forEach(duplicate => { | ||
| var shortenedDescriptions = paths.shorten(duplicates.map(duplicate => duplicate.editor.getDescription())); |
|
@hun1ahpu here is another example I am not sure about: We have:
To me this does not really improve the way I now understand where the files are from. Imho the right fix here is to show as many segments of the path until the description is unique. So I would expect:
|
|
@bpasero I've resolved your comments. It also works for your example now.z |
Tyriar
left a comment
There was a problem hiding this comment.
LGTM from a functionality perspective apart from the minor issue above.
|
@Tyriar "."? like how? Can you give an example how it would look like? |
|
@bpasero just a grey |
|
Ah, so the "." would only show if there is a duplicate. Yeah, I dont mind either way. |
|
Merged, thanks for the fix! |
|
@hun1ahpu your tests seem to fail on macOS. Can you fix them? I moved the code into |
|
@hun1ahpu feel free to open a new PR for this, I was a bit too early to merge this in it seems ;) |




Fix proposal for issue #12040 : Shortening the paths of the duplicate filenames.
Goal
Implementation details and assumptions
Future updates (if this PR is accepted):