Skip to content

Commit b678a6b

Browse files
committed
rustdoc-search: show types signatures in results
1 parent 6e6a0b1 commit b678a6b

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
@@ -260,6 +260,7 @@ a.anchor,
260260
.mobile-topbar h2 a,
261261
h1 a,
262262
.search-results a,
263+
.search-results li,
263264
.stab,
264265
.result-name i {
265266
color: var(--main-color);
@@ -375,7 +376,7 @@ details:not(.toggle) summary {
375376
margin-bottom: .6em;
376377
}
377378

378-
code, pre, .code-header {
379+
code, pre, .code-header, .type-signature {
379380
font-family: "Source Code Pro", monospace;
380381
}
381382
.docblock code, .docblock-short code {
@@ -1189,22 +1190,28 @@ so that we can apply CSS-filters to change the arrow color in themes */
11891190

11901191
.search-results.active {
11911192
display: block;
1193+
margin: 0;
1194+
padding: 0;
11921195
}
11931196

11941197
.search-results > a {
1195-
display: flex;
1198+
display: grid;
1199+
grid-template-areas:
1200+
"search-result-name search-result-desc"
1201+
"search-result-type-signature search-result-type-signature";
1202+
grid-template-columns: .6fr .4fr;
11961203
/* A little margin ensures the browser's outlining of focused links has room to display. */
11971204
margin-left: 2px;
11981205
margin-right: 2px;
11991206
border-bottom: 1px solid var(--search-result-border-color);
1200-
gap: 1em;
1207+
column-gap: 1em;
12011208
}
12021209

12031210
.search-results > a > div.desc {
12041211
white-space: nowrap;
12051212
text-overflow: ellipsis;
12061213
overflow: hidden;
1207-
flex: 2;
1214+
grid-area: search-result-desc;
12081215
}
12091216

12101217
.search-results a:hover,
@@ -1216,7 +1223,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
12161223
display: flex;
12171224
align-items: center;
12181225
justify-content: start;
1219-
flex: 3;
1226+
grid-area: search-result-name;
12201227
}
12211228
.search-results .result-name .alias {
12221229
color: var(--search-results-alias-color);
@@ -1237,6 +1244,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
12371244
.search-results .result-name .path > * {
12381245
display: inline;
12391246
}
1247+
.search-results .type-signature {
1248+
grid-area: search-result-type-signature;
1249+
white-space: pre-wrap;
1250+
}
12401251

12411252
.popover {
12421253
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)