free text search across all scripts

RESOLVED FIXED in Firefox 17

Status

()

Firefox
Developer Tools: Debugger
P2
normal
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: zpao, Assigned: vporof)

Tracking

unspecified
Firefox 17
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

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

Attachments

(2 attachments, 13 obsolete attachments)

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
(Assignee)

Comment 1

5 years ago
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)

Updated

5 years ago
Assignee: nobody → vporof
Status: NEW → ASSIGNED
(Assignee)

Comment 3

5 years ago
Filed bug 779732.
(Assignee)

Updated

5 years ago
Priority: -- → P2
(Assignee)

Updated

5 years ago
Depends on: 781102
(Assignee)

Comment 4

5 years ago
Created attachment 649992 [details] [diff] [review]
v1

WIP.
(Assignee)

Comment 5

5 years ago
Created attachment 650134 [details] [diff] [review]
v2

Basically works. Needs more functionality. I like it.
Attachment #649992 - Attachment is obsolete: true
Attachment #650134 - Flags: feedback?(rcampbell)
(Assignee)

Comment 6

5 years ago
Created attachment 650159 [details]
looks like this
(Assignee)

Updated

5 years ago
Depends on: 780631
(Assignee)

Comment 7

5 years ago
Created attachment 650197 [details] [diff] [review]
v2.1

Rebased, fixed failing tests, monospace all the things.
Attachment #650134 - Attachment is obsolete: true
Attachment #650134 - Flags: feedback?(rcampbell)
Attachment #650197 - Flags: feedback?(rcampbell)
(Assignee)

Comment 8

5 years ago
Created attachment 650382 [details] [diff] [review]
v2.2

Much, much faster.
Attachment #650159 - Attachment is obsolete: true
(Assignee)

Comment 9

5 years ago
Created attachment 650520 [details] [diff] [review]
v3

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)
(Assignee)

Comment 10

5 years ago
Created attachment 650521 [details]
ui
(Assignee)

Comment 11

5 years ago
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!
(Assignee)

Comment 13

5 years ago
Created attachment 650594 [details] [diff] [review]
v4

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)
(Assignee)

Comment 14

5 years ago
Created attachment 650849 [details] [diff] [review]
v4.1

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)
(Assignee)

Comment 15

5 years ago
Created attachment 650900 [details] [diff] [review]
v4.2

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...
(Assignee)

Comment 17

5 years ago
Created attachment 652760 [details] [diff] [review]
v5

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)
(Assignee)

Comment 18

5 years ago
Created attachment 652871 [details] [diff] [review]
v5.1

Moar tests.
Attachment #652760 - Attachment is obsolete: true
Attachment #652760 - Flags: review?(rcampbell)
Attachment #652871 - Flags: review?(rcampbell)
(Assignee)

Comment 19

5 years ago
Created attachment 652911 [details] [diff] [review]
5.2

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 :)
(Assignee)

Comment 21

5 years ago
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)
(Assignee)

Comment 22

5 years ago
Green on try: https://tbpl.mozilla.org/?tree=Try&rev=0f43a3b906f7
_onScriptsCleared is gone from debugger-controller.js after bug 783393. Do we need to do our cleanup elsewhere now?
Depends on: 783393
(Assignee)

Comment 24

5 years ago
(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.
(Assignee)

Comment 25

5 years ago
Created attachment 654543 [details] [diff] [review]
v5.3

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)
(Assignee)

Updated

5 years ago
Blocks: 766054
(Assignee)

Comment 26

5 years ago
Try: https://tbpl.mozilla.org/?tree=Try&rev=b818c53d3af8
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+
(Assignee)

Comment 28

5 years ago
(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.
(Assignee)

Comment 29

5 years ago
Created attachment 655118 [details] [diff] [review]
v5.4

Fixed typo.
(Assignee)

Updated

5 years ago
Whiteboard: [land-in-fx-team]
(Assignee)

Comment 30

5 years ago
https://hg.mozilla.org/integration/fx-team/rev/11a0db7262a0
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]

Comment 31

5 years ago
https://hg.mozilla.org/mozilla-central/rev/11a0db7262a0
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 17

Updated

5 years ago
Depends on: 786156
Depends on: 793444
You need to log in before you can comment on or make changes to this bug.