Open Bug 1206430 Opened 10 years ago Updated 3 years ago

Add CodeMirror scrollbar highlighting addons

Categories

(DevTools :: Source Editor, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: gl, Unassigned)

References

Details

(Whiteboard: [btpp-fix-later])

Attachments

(7 files, 15 obsolete files)

306.42 KB, image/png
Details
313.31 KB, image/png
Details
10.75 KB, patch
bgrins
: review+
Details | Diff | Splinter Review
8.32 KB, patch
bgrins
: review+
Details | Diff | Splinter Review
7.04 KB, patch
Details | Diff | Splinter Review
1.95 KB, patch
Details | Diff | Splinter Review
4.74 KB, patch
Details | Diff | Splinter Review
No description provided.
Status: NEW → ASSIGNED
Summary: Add new CodeMirror 5.6.0 addons → Add new CodeMirror 5.9.0 addons
Summary: Add new CodeMirror 5.9.0 addons → Add new CodeMirror 5.10.0 addons
Attachment #8701918 - Flags: review?(bgrinstead)
Attachment #8701919 - Flags: review?(bgrinstead)
Comment on attachment 8701918 [details] [diff] [review] Part 1: Add new CodeMirror search addons Review of attachment 8701918 [details] [diff] [review]: ----------------------------------------------------------------- After a discussion, we decided to use this bug as a place to come up with a plan and work on the scrollbar and matchesonscrollbar feature instead of importing all the addons (even ones we don't have a plan to use immediately). So the plan is to merge these two patches into one, removing jump-to-line and scrollpastend. Then come up with a demo / screenshot of the scrollbar changes in action so we can work through the designs. And finally, figure out how much work it's going to be to get the debugger to support this.
Attachment #8701918 - Flags: review?(bgrinstead)
Summary: Add new CodeMirror 5.10.0 addons → Add CodeMirror scrollbar highlighting addons
Attachment #8701919 - Flags: review?(bgrinstead)
Attachment #8701918 - Attachment is obsolete: true
Attachment #8701919 - Attachment is obsolete: true
Attachment #8711126 - Attachment is obsolete: true
Attachment #8711127 - Attachment is obsolete: true
Attachment #8711526 - Attachment is obsolete: true
Depends on: 762979
Attachment #8712322 - Attachment description: Screenshot → Screenshot of breakpoint and debugger scrollbar annotation
@helen, Hi, I attached 2 screenshots of the scrollbar annotations for search matches, breakpoints and debugger pointer. Also, you will find a try link to the build for further testing. We want to evaluate what we should do with these scrollbar annotations. Questions: - Should we have scrollbar annotations for search matches? - Should we have scrollbar annotations for breakpoints and debugger pointer? - How should we style these scrollbar annotations? Ideas: - Should we scroll into view when we click on these annotations? Perhaps down the line?
Flags: needinfo?(hholmes)
Looks nice ! How does it look like with the dark theme floating scrollbars though ?
(In reply to Gabriel Luong [:gl] (ΦωΦ) from comment #15) > Questions: > - Should we have scrollbar annotations for search matches? > - Should we have scrollbar annotations for breakpoints and debugger pointer? > - How should we style these scrollbar annotations? I like this and I think we should have them. I would ask :jlongster/:ejpbruel/:linclark in IRC if they have any strong feelings as to why we shouldn't. > Ideas: > - Should we scroll into view when we click on these annotations? Perhaps > down the line? I don't think this is necessary. They'd be very hard to click, and frustrating if you're trying to just use the scrollbar. To be certain I'd ask in #accesibility if they know of any pitfalls when it comes to changing normal scrollbar functionality.
Flags: needinfo?(hholmes)
(In reply to Helen V. Holmes (:helenvholmes) (:✨) from comment #17) > (In reply to Gabriel Luong [:gl] (ΦωΦ) from comment #15) > > Questions: > > - Should we have scrollbar annotations for search matches? > > - Should we have scrollbar annotations for breakpoints and debugger pointer? > > - How should we style these scrollbar annotations? > I like this and I think we should have them. I would ask > :jlongster/:ejpbruel/:linclark in IRC if they have any strong feelings as to > why we shouldn't. > I think I will give a demo during the webconsole and debugger meeting to solicit feedback there. I don't think there is anyone against it.
(In reply to Tim Nguyen [:ntim] from comment #16) > Looks nice ! How does it look like with the dark theme floating scrollbars > though ? Doesn't work on dark theme yet because of floating scrollbars.
Attachment #8711525 - Attachment is obsolete: true
Attachment #8719339 - Flags: review?(bgrinstead)
Attachment #8711531 - Attachment is obsolete: true
Attachment #8719340 - Flags: review?(bgrinstead)
Attachment #8712208 - Attachment is obsolete: true
Attachment #8719341 - Flags: review?(bgrinstead)
Attachment #8712321 - Attachment is obsolete: true
Attachment #8719345 - Flags: review?(bgrinstead)
Attachment #8719341 - Attachment is obsolete: true
Attachment #8719341 - Flags: review?(bgrinstead)
Attachment #8719361 - Flags: review?(bgrinstead)
Part 1 and 2 - only adds the necessary new addons for this feature set. Part 3 - Patches the annotatescrollbar.js addon by removing the cm.display.barWidth check and hardcoding the scrollbar annotation to a width of 14px. We also add a container in the CM element to container these scrollbar annotations. We want to be able to clear all these scrollbar annotations in the future for scenarios such as switching sources in the debugger. Part 4 - The new editor annotateScrollbar method is a bit controversial. To explain further: cm.annotationScrollar({ className }) returns an Annotation object that would take a list of CM.Pos({ line, ch }) in Annotation.update(<list of Pos>) and draw the scrollbar annotations. You can see an example of this in the matchesonscrollbar addon. In the new method, we would create a new Annotation object for each single annotation. The only benefit of this was that it was easier to manage the annotations because we don't have to manage a list of CM.Pos. For instance, going through the list of CM.Pos to remove the Pos of a breakpoint that was removed. I am not quite sure if this is the best solution. Part 5 - Implements the breakpoint annotations and clear the annotations when we switch sources.
It looks like syntax highlighting is broken with these patches applied (haven't double checked but it's something I noticed when applying the patches)
Attachment #8719339 - Attachment is obsolete: true
Attachment #8719339 - Flags: review?(bgrinstead)
Attachment #8720099 - Flags: review?(bgrinstead)
Attachment #8719340 - Attachment is obsolete: true
Attachment #8719340 - Flags: review?(bgrinstead)
Attachment #8720100 - Flags: review?(bgrinstead)
Attachment #8719361 - Attachment is obsolete: true
Attachment #8719361 - Flags: review?(bgrinstead)
Attachment #8720104 - Flags: review?(bgrinstead)
Attachment #8719345 - Attachment is obsolete: true
Attachment #8719345 - Flags: review?(bgrinstead)
Attachment #8720106 - Flags: review?(bgrinstead)
Attachment #8719346 - Attachment is obsolete: true
Attachment #8719346 - Flags: review?(bgrinstead)
Attachment #8720107 - Flags: review?(bgrinstead)
(In reply to Brian Grinstead [:bgrins] from comment #27) > It looks like syntax highlighting is broken with these patches applied > (haven't double checked but it's something I noticed when applying the > patches) This seems to be working for me. I did have to rebase the first 2 patches.
So, the code changes look relatively straightforward here. I think we should have a product and UX consensus on this new feature if possible. Especially, I'm interested in what this looks like on Windows + light theme where there are no floating scrollbars. (In reply to Gabriel Luong [:gl] (ΦωΦ) from comment #19) > (In reply to Tim Nguyen [:ntim] from comment #16) > > Looks nice ! How does it look like with the dark theme floating scrollbars > > though ? > > Doesn't work on dark theme yet because of floating scrollbars. I was thinking it *would* work on the dark theme because of floating scrollbars - I might be confused though. I'd love if we could have screenshots of what this looks like on light/dark theme on Windows and OSX. Gabe, do you have a setup to do that? Also including Bryan to make sure he's aware of this and has a chance to give feedback. One thing I'd suggest is that we have this feature be globally preffable through about:config (though not through the options UI).
Flags: needinfo?(gl)
Flags: needinfo?(clarkbw)
Comment on attachment 8720099 [details] [diff] [review] Part 1: Add new CodeMirror search addons [4.0] Review of attachment 8720099 [details] [diff] [review]: ----------------------------------------------------------------- ::: devtools/client/sourceeditor/codemirror/addon/search/matchesonscrollbar.css @@ +1,3 @@ > +.CodeMirror-search-match { > + background: gold; > + border-top: 1px solid orange; We should override this border-color with our own theme color in mozilla.css, right?
Attachment #8720099 - Flags: review?(bgrinstead) → review+
Attachment #8720100 - Flags: review?(bgrinstead) → review+
Comment on attachment 8720104 [details] [diff] [review] Part 3: Patch CodeMirror's annotatescrollbar to work with floating scrollbars [3.0] Review of attachment 8720104 [details] [diff] [review]: ----------------------------------------------------------------- Why is this needed? ::: devtools/client/sourceeditor/codemirror/addon/scroll/annotatescrollbar.js @@ -96,5 @@ > if (bottom == top) continue; > var height = Math.max(bottom - top, 3); > > var elt = frag.appendChild(document.createElement("div")); > - elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " Could we set barWidth instead of needing to patch the file? ::: devtools/client/sourceeditor/editor.js @@ +402,5 @@ > }); > > + // Add a container for scrollbar annotation > + let doc = cm.getWrapperElement().ownerDocument; > + let annotations = doc.createElement("div"); Not sure I follow the reasoning for this separate container in Comment 26. Can you elaborate?
Attachment #8720104 - Flags: review?(bgrinstead)
Comment on attachment 8720106 [details] [diff] [review] Part 4: Add annotateScrollbar and clearScrollbarAnnotations methods to editor [2.0] Review of attachment 8720106 [details] [diff] [review]: ----------------------------------------------------------------- ::: devtools/client/sourceeditor/editor.js @@ +1222,5 @@ > + /** > + * Clear the scrollbar annotations. > + */ > + clearScrollbarAnnotations: function() { > + let cm = editors.get(this); The CM annotation plugin doesn't have any way to remove all annotations? It looks like removing from the DOM might not end up dropping an event handler that's bound here and removed in clear: http://codemirror.net/addon/search/matchesonscrollbar.js. If that's the case we might need to keep a Map of the current annotations and remove them all on clear()
Attachment #8720106 - Flags: review?(bgrinstead)
Comment on attachment 8720107 [details] [diff] [review] Part 5: Annotate debugger breakpoints and debug location on the scrollbar [2.0] Review of attachment 8720107 [details] [diff] [review]: ----------------------------------------------------------------- I think someone familiar with the debugger should also take a look at this. I'd usually suggest James but I know he's busy right now, so maybe Eddy can do a look-over? ::: devtools/client/sourceeditor/codemirror/mozilla.css @@ +82,5 @@ > background-color: rgba(44,187,15,.1); > } > > +.breakpoint-annotation { > + background: #46AFE3; Colors here should probably use theme variables (or at least create these constants as variables at the top of the file above).
Attachment #8720107 - Flags: review?(bgrinstead) → review?(ejpbruel)
(In reply to Brian Grinstead [:bgrins] from comment #36) > Comment on attachment 8720104 [details] [diff] [review] > Part 3: Patch CodeMirror's annotatescrollbar to work with floating > scrollbars [3.0] > > Review of attachment 8720104 [details] [diff] [review]: > ----------------------------------------------------------------- > > Why is this needed? > > ::: devtools/client/sourceeditor/codemirror/addon/scroll/annotatescrollbar.js > @@ -96,5 @@ > > if (bottom == top) continue; > > var height = Math.max(bottom - top, 3); > > > > var elt = frag.appendChild(document.createElement("div")); > > - elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: " > > Could we set barWidth instead of needing to patch the file? > > ::: devtools/client/sourceeditor/editor.js > @@ +402,5 @@ > > }); > > > > + // Add a container for scrollbar annotation > > + let doc = cm.getWrapperElement().ownerDocument; > > + let annotations = doc.createElement("div"); > > Not sure I follow the reasoning for this separate container in Comment 26. > Can you elaborate? Specifically, if we need to take a different approach like in Comment 37 then maybe we don't need to patch this file anymore?
(In reply to Brian Grinstead [:bgrins] from comment #34) > So, the code changes look relatively straightforward here. I think we > should have a product and UX consensus on this new feature if possible. > Especially, I'm interested in what this looks like on Windows + light theme > where there are no floating scrollbars. > > (In reply to Gabriel Luong [:gl] (ΦωΦ) from comment #19) > > (In reply to Tim Nguyen [:ntim] from comment #16) > > > Looks nice ! How does it look like with the dark theme floating scrollbars > > > though ? > > > > Doesn't work on dark theme yet because of floating scrollbars. > > I was thinking it *would* work on the dark theme because of floating > scrollbars - I might be confused though. I'd love if we could have > screenshots of what this looks like on light/dark theme on Windows and OSX. > Gabe, do you have a setup to do that? Another option instead of pulling down a Windows build would be to enhance the devtools mozscreenshot set to include setting a couple of breakpoints on the test page then we could have a full UI comparison across platforms. If you want to take that on it can be run locally with `./mach mochitest browser/tools/mozscreenshots/devtools/browser_devtools.js` and changed by modifying https://dxr.mozilla.org/mozilla-central/source/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/DevTools.jsm to set some breakpoints in the debugger before taking the screenshot. Then the set could be run in automation with `-u mochitest-browser-screenshots[Ubuntu,10.6,10.10,Windows XP,Windows 7,Windows 8] --setenv MOZSCREENSHOTS_SETS=DevTools`
Flags: needinfo?(gl)
Attachment #8720107 - Flags: review?(ejpbruel)
I think Eddy asked me to take this review, but I don't see any pending reviews? Feel free to r? me
Priority: -- → P2
Whiteboard: [btpp-fix-later]
(In reply to Brian Grinstead [:bgrins] from comment #34) > Also including Bryan to make sure he's aware of this and has a chance to > give feedback. One thing I'd suggest is that we have this feature be > globally preffable through about:config (though not through the options UI). This looks good to me. The debugger breakpoint listing change is great. And I think the filter option will improve our search input. If we're unsure how this will perform or if its ready for prime time lets hide it behind a pref at first or limit it to Nightly.
Flags: needinfo?(clarkbw)
Assignee: gl → nobody
Status: ASSIGNED → NEW
Severity: normal → enhancement
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: