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

Side by Side Diff: pkg/dartdoc/lib/src/client/search.dart

Issue 11039018: Show noargs methods as () instead of (...) in find-as-you-type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/dartdoc/lib/src/client/dropdown.dart ('k') | pkg/dartdoc/lib/src/dartdoc/nav.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * [SearchText] represent the search field text. The text is viewed in three 6 * [SearchText] represent the search field text. The text is viewed in three
7 * ways: [text] holds the original search text, used for performing 7 * ways: [text] holds the original search text, used for performing
8 * case-sensitive matches, [lowerCase] holds the lower-case search text, used 8 * case-sensitive matches, [lowerCase] holds the lower-case search text, used
9 * for performing case-insenstive matches, [camelCase] holds a camel-case 9 * for performing case-insenstive matches, [camelCase] holds a camel-case
10 * interpretation of the search text, used to order matches in camel-case. 10 * interpretation of the search text, used to order matches in camel-case.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 */ 74 */
75 class Result { 75 class Result {
76 final StringMatch prefix; 76 final StringMatch prefix;
77 final StringMatch match; 77 final StringMatch match;
78 78
79 final String library; 79 final String library;
80 final String type; 80 final String type;
81 final String args; 81 final String args;
82 final String kind; 82 final String kind;
83 final String url; 83 final String url;
84 final bool noargs;
84 85
85 TableRowElement row; 86 TableRowElement row;
86 87
87 Result(this.match, this.kind, this.url, 88 Result(this.match, this.kind, this.url,
88 [this.library, this.type, String args, this.prefix]) 89 {this.library: null, this.type: null, String args: null,
90 this.prefix: null, this.noargs: false})
89 : this.args = args != null ? '<$args>' : ''; 91 : this.args = args != null ? '<$args>' : '';
90 92
91 bool get isTopLevel => prefix == null && type == null; 93 bool get isTopLevel => prefix == null && type == null;
92 94
93 void addRow(TableElement table) { 95 void addRow(TableElement table) {
94 if (row != null) return; 96 if (row != null) return;
95 97
96 clickHandler(Event event) { 98 clickHandler(Event event) {
97 window.location.href = url; 99 window.location.href = url;
98 hideDropDown(); 100 hideDropDown();
99 } 101 }
100 102
101 row = table.insertRow(table.rows.length); 103 row = table.insertRow(table.rows.length);
102 row.classes.add('drop-down-link-tr'); 104 row.classes.add('drop-down-link-tr');
103 row.on.mouseDown.add((event) => hideDropDownSuspend = true); 105 row.on.mouseDown.add((event) => hideDropDownSuspend = true);
104 row.on.click.add(clickHandler); 106 row.on.click.add(clickHandler);
105 row.on.mouseUp.add((event) => hideDropDownSuspend = false); 107 row.on.mouseUp.add((event) => hideDropDownSuspend = false);
106 var sb = new StringBuffer(); 108 var sb = new StringBuffer();
107 sb.add('<td class="drop-down-link-td">'); 109 sb.add('<td class="drop-down-link-td">');
108 sb.add('<table class="drop-down-table"><tr><td colspan="2">'); 110 sb.add('<table class="drop-down-table"><tr><td colspan="2">');
109 if (kind == GETTER) { 111 if (kind == GETTER) {
110 sb.add('get '); 112 sb.add('get ');
111 } else if (kind == SETTER) { 113 } else if (kind == SETTER) {
112 sb.add('set '); 114 sb.add('set ');
113 } 115 }
114 sb.add(match.toHtml()); 116 sb.add(match.toHtml());
115 if (kind == CLASS || kind == INTERFACE || kind == TYPEDEF) { 117 if (kind == CLASS || kind == INTERFACE || kind == TYPEDEF) {
116 sb.add(args); 118 sb.add(args);
117 } else if (kind == CONSTRUCTOR || kind == METHOD) { 119 } else if (kind == CONSTRUCTOR || kind == METHOD) {
118 sb.add('(...)'); 120 if (noargs) {
121 sb.add("()");
122 } else {
123 sb.add('(...)');
124 }
119 } 125 }
120 sb.add('</td></tr><tr><td class="drop-down-link-kind">'); 126 sb.add('</td></tr><tr><td class="drop-down-link-kind">');
121 sb.add(kindToString(kind)); 127 sb.add(kindToString(kind));
122 if (prefix != null) { 128 if (prefix != null) {
123 sb.add(' in '); 129 sb.add(' in ');
124 sb.add(prefix.toHtml()); 130 sb.add(prefix.toHtml());
125 sb.add(args); 131 sb.add(args);
126 } else if (type != null) { 132 } else if (type != null) {
127 sb.add(' in '); 133 sb.add(' in ');
128 sb.add(type); 134 sb.add(type);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Sort type alphabetically. 215 // Sort type alphabetically.
210 // TODO(4805): Use [:type.compareToIgnoreCase] when supported. 216 // TODO(4805): Use [:type.compareToIgnoreCase] when supported.
211 result = a.type.toLowerCase().compareTo(b.type.toLowerCase()); 217 result = a.type.toLowerCase().compareTo(b.type.toLowerCase());
212 if (result != 0) return result; 218 if (result != 0) return result;
213 } 219 }
214 220
215 // Sort match alphabetically. 221 // Sort match alphabetically.
216 // TODO(4805): Use [:text.compareToIgnoreCase] when supported. 222 // TODO(4805): Use [:text.compareToIgnoreCase] when supported.
217 return a.match.text.toLowerCase().compareTo(b.match.text.toLowerCase()); 223 return a.match.text.toLowerCase().compareTo(b.match.text.toLowerCase());
218 } 224 }
OLDNEW
« no previous file with comments | « pkg/dartdoc/lib/src/client/dropdown.dart ('k') | pkg/dartdoc/lib/src/dartdoc/nav.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698