@@ -35,6 +35,35 @@ const itemTypes = [
35
35
"traitalias" ,
36
36
] ;
37
37
38
+ const longItemTypes = [
39
+ "module" ,
40
+ "extern crate" ,
41
+ "re-export" ,
42
+ "struct" ,
43
+ "enum" ,
44
+ "function" ,
45
+ "type alias" ,
46
+ "static" ,
47
+ "trait" ,
48
+ "" ,
49
+ "trait method" ,
50
+ "method" ,
51
+ "struct field" ,
52
+ "enum variant" ,
53
+ "macro" ,
54
+ "primitive type" ,
55
+ "associated type" ,
56
+ "constant" ,
57
+ "associated constant" ,
58
+ "union" ,
59
+ "foreign type" ,
60
+ "keyword" ,
61
+ "existential type" ,
62
+ "attribute macro" ,
63
+ "derive macro" ,
64
+ "trait alias" ,
65
+ ] ;
66
+
38
67
// used for special search precedence
39
68
const TY_PRIMITIVE = itemTypes . indexOf ( "primitive" ) ;
40
69
const TY_KEYWORD = itemTypes . indexOf ( "keyword" ) ;
@@ -1836,16 +1865,11 @@ function initSearch(rawSearchIndex) {
1836
1865
array . forEach ( item => {
1837
1866
const name = item . name ;
1838
1867
const type = itemTypes [ item . ty ] ;
1868
+ const longType = longItemTypes [ item . ty ] ;
1869
+ let extra = longType . length !== 0 ? ` <i>(${ longType } )</i>` : "" ;
1839
1870
1840
1871
length += 1 ;
1841
1872
1842
- let extra = "" ;
1843
- if ( type === "primitive" ) {
1844
- extra = " <i>(primitive type)</i>" ;
1845
- } else if ( type === "keyword" ) {
1846
- extra = " <i>(keyword)</i>" ;
1847
- }
1848
-
1849
1873
const link = document . createElement ( "a" ) ;
1850
1874
link . className = "result-" + type ;
1851
1875
link . href = item . href ;
@@ -1854,6 +1878,7 @@ function initSearch(rawSearchIndex) {
1854
1878
resultName . className = "result-name" ;
1855
1879
1856
1880
if ( item . is_alias ) {
1881
+ extra = "" ;
1857
1882
const alias = document . createElement ( "span" ) ;
1858
1883
alias . className = "alias" ;
1859
1884
@@ -1863,13 +1888,13 @@ function initSearch(rawSearchIndex) {
1863
1888
1864
1889
alias . insertAdjacentHTML (
1865
1890
"beforeend" ,
1866
- "<span class=\"grey\"><i> - see </i></span >" ) ;
1891
+ "<i class=\"grey\"> - see </i>" ) ;
1867
1892
1868
1893
resultName . appendChild ( alias ) ;
1869
1894
}
1870
1895
resultName . insertAdjacentHTML (
1871
1896
"beforeend" ,
1872
- item . displayPath + "<span class=\"" + type + "\">" + name + extra + "</span>" ) ;
1897
+ item . displayPath + "<span class=\"" + type + "\">" + name + "</span>" + extra ) ;
1873
1898
link . appendChild ( resultName ) ;
1874
1899
1875
1900
const description = document . createElement ( "div" ) ;
0 commit comments