debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Pretty Print] Better format duplicate filename text

Open darkwing opened this issue 8 years ago β€’ 21 comments

We should incorporate logic that doesn't do the extended file information when they're the same file, only pretty-printed.

probs

darkwing avatar Jul 31 '18 21:07 darkwing

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", () => {

darkwing avatar Jul 31 '18 22:07 darkwing

/claim

jaikathuria avatar Aug 06 '18 15:08 jaikathuria

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 avatar Aug 06 '18 15:08 claim

@darkwing Have you thought on the behavior is the path name is too large? Should we truncate as we do for the filenames?

jainsneha23 avatar Aug 08 '18 05:08 jainsneha23

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 πŸ™„

jaikathuria avatar Aug 08 '18 06:08 jaikathuria

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.

darkwing avatar Aug 08 '18 16:08 darkwing

hmm, if the preceding part is long we could show .../abc/project2/...

@jainsneha23 is this easy to modify with your existing logic?

jasonLaster avatar Aug 08 '18 16:08 jasonLaster

@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.

screen shot 2018-08-14 at 4 36 03 pm

Also, when the path gets truncated, the title and truncated path are not in sync.

screen shot 2018-08-14 at 4 42 09 pm

jainsneha23 avatar Aug 14 '18 11:08 jainsneha23

i think we should drop query strings from paths. perhaps show them for titles where you want more info...

jasonLaster avatar Aug 14 '18 13:08 jasonLaster

Please close this.

ryzokuken avatar Sep 03 '18 09:09 ryzokuken

/claim

Narrator avatar Sep 07 '18 20:09 Narrator

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 avatar Sep 07 '18 20:09 claim

/claim

Doomwyte avatar Sep 22 '18 14:09 Doomwyte

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 avatar Sep 22 '18 14:09 claim

/claim

ghost avatar Oct 15 '18 05:10 ghost

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 avatar Oct 15 '18 05:10 claim

/claim

jainsneha23 avatar Nov 14 '18 09:11 jainsneha23

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 avatar Nov 14 '18 09:11 claim

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?

jainsneha23 avatar Nov 15 '18 05:11 jainsneha23

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!

darkwing avatar Dec 09 '18 23:12 darkwing