Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Issue 10829361: 'Find-as-you-type'-search in dartdoc/apidoc. (Closed)

Created:
8 years, 4 months ago by Johnni Winther
Modified:
8 years, 3 months ago
CC:
reviews_dartlang.org, Jennifer Messerly, Bob Nystrom, jjinux
Visibility:
Public.

Description

'Find-as-you-type'-search in dartdoc/apidoc. Committed: https://code.google.com/p/dart/source/detail?r=11508

Patch Set 1 #

Patch Set 2 : CSS bug fixed #

Total comments: 34

Patch Set 3 : Refactored and updated cf. comments #

Patch Set 4 : Updated cf. comments from lrn. #

Patch Set 5 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1046 lines, -116 lines) Patch
M pkg/dartdoc/client-live-nav.dart View 1 2 3 chunks +27 lines, -36 lines 0 comments Download
M pkg/dartdoc/client-shared.dart View 2 chunks +40 lines, -1 line 0 comments Download
M pkg/dartdoc/client-static.dart View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M pkg/dartdoc/dartdoc.dart View 1 2 9 chunks +157 lines, -25 lines 0 comments Download
A pkg/dartdoc/dropdown.dart View 1 2 3 1 chunk +344 lines, -0 lines 0 comments Download
M pkg/dartdoc/mirrors/dart2js_mirror.dart View 1 2 3 4 5 chunks +52 lines, -40 lines 0 comments Download
A pkg/dartdoc/nav.dart View 1 2 3 1 chunk +73 lines, -0 lines 0 comments Download
A pkg/dartdoc/search.dart View 1 2 3 1 chunk +218 lines, -0 lines 0 comments Download
M pkg/dartdoc/static/styles.css View 1 2 2 chunks +62 lines, -1 line 0 comments Download
A tests/utils/dartdoc_search_test.dart View 1 2 3 1 chunk +51 lines, -0 lines 0 comments Download
M utils/apidoc/apidoc.dart View 1 2 3 3 chunks +13 lines, -13 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Johnni Winther
8 years, 4 months ago (2012-08-16 19:53:50 UTC) #1
Lasse Reichstein Nielsen
Looks odd to me, but ok if it works. https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/client-live-nav.dart File pkg/dartdoc/client-live-nav.dart (right): https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/client-live-nav.dart#newcode37 pkg/dartdoc/client-live-nav.dart:37: ...
8 years, 4 months ago (2012-08-20 13:07:58 UTC) #2
Johnni Winther
8 years, 4 months ago (2012-08-23 10:19:50 UTC) #3
PTAL

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/client-...
File pkg/dartdoc/client-live-nav.dart (right):

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/client-...
pkg/dartdoc/client-live-nav.dart:37: buildNavigation(List libraries) {
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Better, but List of what?

It is JSON, so List<Map<String,...?...>>, currently. I'll put types on all
for-each loop variables instead so expected type is documented.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/dartdoc...
File pkg/dartdoc/dartdoc.dart (right):

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/dartdoc...
pkg/dartdoc/dartdoc.dart:618: <div class="drop-down" id="drop-down"></div>
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Why both id and class? Are there any other elements with class drop-down?

I just dislike referring to 'id' in CSS and 'class' in single-point queries, so
'id' for element identity and 'class' for its style.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/dartdoc...
pkg/dartdoc/dartdoc.dart:699: // Ignore.
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> I still don't like this.
> It's really a bad idea to ignore an exception without checking what caused it.
> Maybe it isn't "file already exists"?

There seems to be a solution to 3914 underway.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/mirrors...
File pkg/dartdoc/mirrors/dart2js_mirror.dart (right):

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/mirrors...
pkg/dartdoc/mirrors/dart2js_mirror.dart:1232: _constructorName =
_name.substring(dollarPos+1);
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Spaces around '+'.

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
File pkg/dartdoc/search.dart (right):

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:31: * substring within a [text]. The matched [text] is
split into the [prefixText],
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> What variable does [text] refer to?

To the property, that is the getter 'text'.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:32: * [infixText], and [suffixText], where [infixText]
is the part matching the
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Why not just call it "matchText"? And perhaps "preMatchText"/"postMatchText".
> Are they always needed, or could you just store the position of the match and
> compute them dynamically if needed?

They are used extensively so I prefer creating them once.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:60: * Is `true` iff [searchText] matches the full [text]
case-sensitively.
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Drop the quoting around 'true'. If you want something different, write it
> [:true:].

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:156: String infixText = text.substring(offset,
offset+searchText.length);
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Spaces around '+'. Ditto next line.

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:163: int compareBools(bool a, bool b) {
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Document that it considers true bigger than false.
> And that it doesn't handle null.

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:172: else return 0;
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Aren't numbers comparable? I.e., a.compareTo(b)?

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:175: int resultComparator(Result a, Result b) {
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> That's a lot of work to do in a sort comparison function.

Yes, but we have a lot of situations to handle!

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:210: result =
a.type.toLowerCase().compareTo(b.type.toLowerCase());
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> This is particularly worrisome. You can have a quadratic number of comparisons
> in a sort (worst case) and doing case conversion on both comparands seems
likely
> to explode.
> 
> Then again, we should probably have "String.compareNoCase" to handle that, and
> we don't.

Yes, I looked for that!

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:220: DivElement dropdown;
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Is this a global variable? That isn't even private?!?
> Ick. 
> Argh.
> Ok, but still!!!

This is a web page and the DOM is global!

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:281: StringMatch memberMatch = obtainMatch(emptyText,
member[NAME]);
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> Line too long.

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:324: }
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> These huge blobs of complex code would be great as separate functions.
> Preferably with a meaningful name and good documentation.
> I.e., I have no idea what happens here, and I can't read the code.

Refactored into several methods.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/search....
pkg/dartdoc/search.dart:492: if (event.keyCode == 70/*F*/ && event.ctrlKey ||
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> I prefer hex for keycodes. I.e., 0x46.

Done.

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/static/...
File pkg/dartdoc/static/styles.css (right):

https://chromiumcodereview.appspot.com/10829361/diff/3001/pkg/dartdoc/static/...
pkg/dartdoc/static/styles.css:153: }
On 2012/08/20 13:07:58, Lasse Reichstein Nielsen wrote:
> empty lines between declarations.

Done.

Powered by Google App Engine
This is Rietveld 408576698