Skip to content

Commit 20a4b4f

Browse files
committed
rustdoc-search: show types signatures in results
1 parent 5973005 commit 20a4b4f

File tree

10 files changed

+995
-126
lines changed

10 files changed

+995
-126
lines changed

src/librustdoc/html/static/css/rustdoc.css

+16-5
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ a.anchor,
264264
.mobile-topbar h2 a,
265265
h1 a,
266266
.search-results a,
267+
.search-results li,
267268
.stab,
268269
.result-name i {
269270
color: var(--main-color);
@@ -379,7 +380,7 @@ details:not(.toggle) summary {
379380
margin-bottom: .6em;
380381
}
381382

382-
code, pre, .code-header {
383+
code, pre, .code-header, .type-signature {
383384
font-family: "Source Code Pro", monospace;
384385
}
385386
.docblock code, .docblock-short code {
@@ -1205,22 +1206,28 @@ so that we can apply CSS-filters to change the arrow color in themes */
12051206

12061207
.search-results.active {
12071208
display: block;
1209+
margin: 0;
1210+
padding: 0;
12081211
}
12091212

12101213
.search-results > a {
1211-
display: flex;
1214+
display: grid;
1215+
grid-template-areas:
1216+
"search-result-name search-result-desc"
1217+
"search-result-type-signature search-result-type-signature";
1218+
grid-template-columns: .6fr .4fr;
12121219
/* A little margin ensures the browser's outlining of focused links has room to display. */
12131220
margin-left: 2px;
12141221
margin-right: 2px;
12151222
border-bottom: 1px solid var(--search-result-border-color);
1216-
gap: 1em;
1223+
column-gap: 1em;
12171224
}
12181225

12191226
.search-results > a > div.desc {
12201227
white-space: nowrap;
12211228
text-overflow: ellipsis;
12221229
overflow: hidden;
1223-
flex: 2;
1230+
grid-area: search-result-desc;
12241231
}
12251232

12261233
.search-results a:hover,
@@ -1232,7 +1239,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
12321239
display: flex;
12331240
align-items: center;
12341241
justify-content: start;
1235-
flex: 3;
1242+
grid-area: search-result-name;
12361243
}
12371244
.search-results .result-name .alias {
12381245
color: var(--search-results-alias-color);
@@ -1253,6 +1260,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
12531260
.search-results .result-name .path > * {
12541261
display: inline;
12551262
}
1263+
.search-results .type-signature {
1264+
grid-area: search-result-type-signature;
1265+
white-space: pre-wrap;
1266+
}
12561267

12571268
.popover {
12581269
position: absolute;

src/librustdoc/html/static/js/externs.js

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ let Results;
9292
* parent: (Object|undefined),
9393
* path: string,
9494
* ty: number,
95+
* type: FunctionSearchType?,
96+
* displayType: Promise<Array<Array<string>>>|null,
97+
* displayTypeMappedNames: Promise<Array<[string, Array<string>]>>|null,
9598
* }}
9699
*/
97100
let ResultObject;

0 commit comments

Comments
 (0)