[Pretty Print] Better format duplicate filename text
We should incorporate logic that doesn't do the extended file information when they're the same file, only pretty-printed.

Here's a start:
diff --git a/src/utils/source.js b/src/utils/source.js
index 250405b73..5b678d30c 100644
--- a/src/utils/source.js
+++ b/src/utils/source.js
@@ -182,7 +182,9 @@ export function getDisplayPath(mySource: Source, sources: Source[]) {
// Find sources that have the same filename, but different paths
// as the original source
const similarSources = sources.filter(
- source => mySource.url != source.url && filename == getFilename(source)
+ source =>
+ getRawSourceURL(mySource.url) != getRawSourceURL(source.url) &&
+ filename == getFilename(source)
);
if (similarSources.length == 0) {
diff --git a/src/utils/tests/source.spec.js b/src/utils/tests/source.spec.js
index bb67e4564..8ede4e34b 100644
--- a/src/utils/tests/source.spec.js
+++ b/src/utils/tests/source.spec.js
@@ -135,7 +135,7 @@ describe("sources", () => {
).toBe("abc/web");
});
- it("should give np path for files with unique name", () => {
+ it("should give no path for files with unique name", () => {
expect(
getDisplayPath(
{
@@ -159,6 +159,32 @@ describe("sources", () => {
)
).toBe(undefined);
});
+
+ it("should not show display path for pretty file", () => {
+ expect(
+ getDisplayPath(
+ {
+ url:
+ "http://localhost.com:7999/increment/abc/web/hello.html:formatted",
+ id: ""
+ },
+ [
+ {
+ url: "http://localhost.com:7999/increment/xyz/web/hello.html",
+ id: ""
+ },
+ {
+ url: "http://localhost.com:7999/increment/abc/web/hello.html",
+ id: ""
+ },
+ {
+ url: "http://localhost.com:7999/increment/hello.html",
+ id: ""
+ }
+ ]
+ )
+ ).toBe(undefined);
+ });
});
describe("getFileURL", () => {
/claim
Thanks for claiming the issue! :wave:
!!! Please check your email and confirm the invitation
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
@darkwing Have you thought on the behavior is the path name is too large? Should we truncate as we do for the filenames?
I guess something can be done here for large paths but truncate them wonβt be good idea. Assume the following case when paths are
abc/project2/html/landing/
abc/project3/html/landing/
If we truncate both for say 15 length the main difference between two paths that we actually want to display to differentiate between the files would be missing. Just my thoughts π
I'm wondering if there's a logical way to identify the difference between the two paths and show that, i.e. project2 vs project 3 in @jaikathuria 's example.
hmm, if the preceding part is long we could show .../abc/project2/...
@jainsneha23 is this easy to modify with your existing logic?
@jasonLaster @darkwing @jaikathuria We also have very long paths like in www.google.com, which made me feel like truncating. @jaikathuria your example also makes sense. So, we have 2 cases here.
Also, when the path gets truncated, the title and truncated path are not in sync.
i think we should drop query strings from paths. perhaps show them for titles where you want more info...
Please close this.
/claim
Thanks for claiming the issue! :wave:
!!! Please check your email and confirm the invitation
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
!!! Please check your email and confirm the invitation
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
Seems like the original requirement of the issue is fixed and merged. What else is pending to be done here? @darkwing Else can we close this issue please?
Your work was amazing @jainsneha23! Thank you so much!
I'm going to look into improving the logic this week, so let's keep it open for now. Thank you!