Closed Bug 774788 Opened 12 years ago Closed 12 years ago

free text search across all scripts

Categories

(DevTools :: Debugger, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 17

People

(Reporter: zpao, Assigned: vporof)

References

Details

(Whiteboard: [fixed-in-fx-team])

Attachments

(2 files, 13 obsolete files)

It's possible to search within the currently selected file with a magical operator, but I have no idea which file I need to scope my search due to files being combined with nondescript filenames.

IRC discussion leaned towards a new operator, but the operator is really undiscoverable and we can do better. I think we could maybe surface this by having a dropdown radio menu off the magnifier to specify which search type, which would also get reflected in the placeholder text.

* filename
* search current file
* search all files
We could start with the operator first and add a dropdown menu for all the search methods in a followup. Does that sound ok?
Sounds fine to me, just wanted to get all my thoughts out so they didn't get lost. Thanks Victor!
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Filed bug 779732.
Priority: -- → P2
Depends on: 781102
Attached patch v1 (obsolete) — Splinter Review
WIP.
Attached patch v2 (obsolete) — Splinter Review
Basically works. Needs more functionality. I like it.
Attachment #649992 - Attachment is obsolete: true
Attachment #650134 - Flags: feedback?(rcampbell)
Attached image looks like this (obsolete) —
Depends on: 780631
Attached patch v2.1 (obsolete) — Splinter Review
Rebased, fixed failing tests, monospace all the things.
Attachment #650134 - Attachment is obsolete: true
Attachment #650134 - Flags: feedback?(rcampbell)
Attachment #650197 - Flags: feedback?(rcampbell)
Attached patch v2.2 (obsolete) — Splinter Review
Much, much faster.
Attachment #650159 - Attachment is obsolete: true
Attached patch v3 (obsolete) — Splinter Review
Created a search job pool to speed things up even more.

Clicking on matches jumps the editor to the appropriate file/line and adds a selection around the match.

Pressing ENTER will automatically jump to the first/next match.

Bounce animations!

Speed-wise, this is as fast as I can get it to be.
I also think this is ready UX/UI-wise. Need to write a test and we're done.

Rob, what do you think?
Attachment #650197 - Attachment is obsolete: true
Attachment #650382 - Attachment is obsolete: true
Attachment #650197 - Flags: feedback?(rcampbell)
Attachment #650520 - Flags: feedback?(rcampbell)
Attached image ui (obsolete) —
Heh. Chrome does a trick thing when searching: it only shows matches for a single script, and collapses all the other stuff.

Searching is pretty fast with the current implementation in this patch, however creating the UI takes quite a while and it's the only bottleneck. If I'd also automatically collapse everything except the first results (like Chrome does), then the performance improvement would be quite significant!

I'll give this a shot.
some feedback:

Maybe hold off on search and display until the user's stopped typing. (100ms should be enough).

Search results don't scroll when hitting Enter to go to next search result.

NICE!
Attached patch v4 (obsolete) — Splinter Review
Optimized the optimizations yo! Addressed rob's comments regarding delayed search.
Scroll into view needs work.
Attachment #650520 - Attachment is obsolete: true
Attachment #650520 - Flags: feedback?(rcampbell)
Attached patch v4.1 (obsolete) — Splinter Review
Fixed text failures. Cleaned up. Polished. Shaved.
Rob, is there any beachballing going on?
Attachment #650594 - Attachment is obsolete: true
Attachment #650849 - Flags: feedback?(rcampbell)
Attached patch v4.2 (obsolete) — Splinter Review
Search results now scroll when hitting Enter to go to next search result.

Also, scrolling now automatically expands any collapsed search results that are brought into view.

Writing tests for all this stuff is going to be FUN.

FUN.
Attachment #650849 - Attachment is obsolete: true
Attachment #650849 - Flags: feedback?(rcampbell)
beautiful. I do think we should expand the results by default rather than force a user to click them.

*time passes*

... victor replies with a solution to auto-expand search results when scrolled into view, thereby saving some milliseconds on initial results population...
Attached patch v5 (obsolete) — Splinter Review
This is it.
I think I may add another test just to make sure the coverage is super high, but this is definitely reviewable.
Attachment #650900 - Attachment is obsolete: true
Attachment #652760 - Flags: review?(rcampbell)
Attached patch v5.1 (obsolete) — Splinter Review
Moar tests.
Attachment #652760 - Attachment is obsolete: true
Attachment #652760 - Flags: review?(rcampbell)
Attachment #652871 - Flags: review?(rcampbell)
Attached patch 5.2 (obsolete) — Splinter Review
Minor changes, reworded some weirdly named events, fixed a potential race condition between clearing the global search view and the scripts cache in the frontend. Try looks green so far.
<3

There's more where that came from when some UI comes together :)
Comment on attachment 650521 [details]
ui

Ping shorlander for feedback.
Video of the thing in action: https://dl.dropbox.com/u/2388316/global-search.webm
Attachment #650521 - Flags: feedback?(shorlander)
_onScriptsCleared is gone from debugger-controller.js after bug 783393. Do we need to do our cleanup elsewhere now?
Depends on: 783393
(In reply to Rob Campbell [:rc] (:robcee) from comment #23)
> _onScriptsCleared is gone from debugger-controller.js after bug 783393. Do
> we need to do our cleanup elsewhere now?

No it's not... It's called manually in handleTabNavigation. It has been called manually since forever actually, since the scriptscleared event was never implemented in the prototcol. Development is fun.
Attached patch v5.3Splinter Review
Qrefed a failing hunk and rebased on top of THE BUG.
Attachment #650521 - Attachment is obsolete: true
Attachment #652871 - Attachment is obsolete: true
Attachment #652911 - Attachment is obsolete: true
Attachment #650521 - Flags: feedback?(shorlander)
Attachment #652871 - Flags: review?(rcampbell)
Attachment #654543 - Flags: review?(rcampbell)
Blocks: 766054
Comment on attachment 654543 [details] [diff] [review]
v5.3

Review of attachment 654543 [details] [diff] [review]:
-----------------------------------------------------------------

alright, not a lot to comment on with this. Works well, looks decent.

::: browser/devtools/debugger/debugger-controller.js
@@ +1191,4 @@
>     *        Additional options for showing the script. Supported options:
>     *        - targetLine: place the editor at the given line number.
>     */
> +  showScript: function SS_showScript(aScript, aOptions = {}) {

You made me look this up. Since Firefox 15?

rewrite everything.

::: browser/devtools/debugger/debugger-view.js
@@ +167,5 @@
> +  this._onFetchScriptsFinished = this._onFetchScriptsFinished.bind(this);
> +  this._onLineClick = this._onLineClick.bind(this);
> +  this._onMatchClick = this._onMatchClick.bind(this);
> +  this._onResultsScroll = this._onResultsScroll.bind(this);
> +  this._startSerach = this._startSerach.bind(this);

TYYYPPPOOOO!!!!

@@ +258,5 @@
> +
> +  /**
> +   * Starts searching for a token in all the scripts.
> +   */
> +  _startSerach: function DVGS__startSearch() {

typo. (oh no, he's doing it again)

@@ +668,5 @@
> +  /**
> +   * Scrolls a match into view.
> +   * @param nsIDOMElement aTarget
> +   */
> +  _scrollMatchIntoViewIfNeeded: function DVGS__scrollMatchIntoViewIfNeeded(aTarget) {

did you try using the version of this in shared/LayoutHelpers.jsm?

This is simpler, and I do like that, but we should reuse code where possible.
Attachment #654543 - Flags: review?(rcampbell) → review+
(In reply to Rob Campbell [:rc] (:robcee) from comment #27)
> Comment on attachment 654543 [details] [diff] [review]
> v5.3
> 
> Review of attachment 654543 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> alright, not a lot to comment on with this. Works well, looks decent.
> 
> ::: browser/devtools/debugger/debugger-controller.js
> @@ +1191,4 @@
> >     *        Additional options for showing the script. Supported options:
> >     *        - targetLine: place the editor at the given line number.
> >     */
> > +  showScript: function SS_showScript(aScript, aOptions = {}) {
> 
> You made me look this up. Since Firefox 15?
> 
> rewrite everything.

Can I start with Tilt?

> 
> ::: browser/devtools/debugger/debugger-view.js
> @@ +167,5 @@
> > +  this._onFetchScriptsFinished = this._onFetchScriptsFinished.bind(this);
> > +  this._onLineClick = this._onLineClick.bind(this);
> > +  this._onMatchClick = this._onMatchClick.bind(this);
> > +  this._onResultsScroll = this._onResultsScroll.bind(this);
> > +  this._startSerach = this._startSerach.bind(this);
> 
> TYYYPPPOOOO!!!!

I'll make a Sublime plugin.

> 
> @@ +258,5 @@
> > +
> > +  /**
> > +   * Starts searching for a token in all the scripts.
> > +   */
> > +  _startSerach: function DVGS__startSearch() {
> 
> typo. (oh no, he's doing it again)
> 

:(

> @@ +668,5 @@
> > +  /**
> > +   * Scrolls a match into view.
> > +   * @param nsIDOMElement aTarget
> > +   */
> > +  _scrollMatchIntoViewIfNeeded: function DVGS__scrollMatchIntoViewIfNeeded(aTarget) {
> 
> did you try using the version of this in shared/LayoutHelpers.jsm?
> 

I tried, doesn't work at all.

> This is simpler, and I do like that, but we should reuse code where possible.

I like simple code.
Attached patch v5.4Splinter Review
Fixed typo.
Whiteboard: [land-in-fx-team]
https://hg.mozilla.org/integration/fx-team/rev/11a0db7262a0
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/11a0db7262a0
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17
Depends on: 786156
Depends on: 793444
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: