rustdoc-search: pass original names through AST

This commit is contained in:
Michael Howell 2024-09-24 12:33:09 -07:00
parent 2cc1c0c39a
commit 5c7e7dfe10
19 changed files with 295 additions and 487 deletions

View file

@ -11,30 +11,29 @@ const PARSED = [
}],
returned: [],
foundElems: 1,
original: "中文",
userQuery: "中文",
error: null,
},
{
query: '_0Mixed中英文',
elems: [{
name: "_0mixed中英文",
name: "_0Mixed中英文",
fullPath: ["_0mixed中英文"],
pathWithoutLast: [],
pathLast: "_0mixed中英文",
normalizedPathLast: "0mixed中英文",
generics: [],
typeFilter: -1,
}],
foundElems: 1,
original: "_0Mixed中英文",
userQuery: "_0Mixed中英文",
returned: [],
userQuery: "_0mixed中英文",
error: null,
},
{
query: 'my_crate::中文API',
elems: [{
name: "my_crate::中文api",
name: "my_crate::中文API",
fullPath: ["my_crate", "中文api"],
pathWithoutLast: ["my_crate"],
pathLast: "中文api",
@ -42,26 +41,25 @@ const PARSED = [
typeFilter: -1,
}],
foundElems: 1,
original: "my_crate::中文API",
userQuery: "my_crate::中文API",
returned: [],
userQuery: "my_crate::中文api",
error: null,
},
{
query: '类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>',
elems: [{
name: "类型a",
name: "类型A",
fullPath: ["类型a"],
pathWithoutLast: [],
pathLast: "类型a",
generics: [],
}, {
name: "类型b",
name: "类型B",
fullPath: ["类型b"],
pathWithoutLast: [],
pathLast: "类型b",
generics: [{
name: "约束c",
name: "约束C",
fullPath: ["约束c"],
pathWithoutLast: [],
pathLast: "约束c",
@ -71,15 +69,21 @@ const PARSED = [
foundElems: 3,
totalElems: 5,
literalSearch: true,
original: "类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>",
userQuery: "类型A,类型B<约束C>->返回类型<关联类型=路径::约束D>",
returned: [{
name: "返回类型",
fullPath: ["返回类型"],
pathWithoutLast: [],
pathLast: "返回类型",
generics: [],
bindings: [["关联类型", [{
name: "路径::约束D",
fullPath: ["路径", "约束d"],
pathWithoutLast: ["路径"],
pathLast: "约束d",
generics: [],
}]]],
}],
userQuery: "类型a,类型b<约束c>->返回类型<关联类型=路径::约束d>",
error: null,
},
{
@ -93,18 +97,16 @@ const PARSED = [
typeFilter: 16,
}],
foundElems: 1,
original: "my_crate 中文宏!",
returned: [],
userQuery: "my_crate 中文宏!",
returned: [],
error: null,
},
{
query: '非法符号——',
elems: [],
foundElems: 0,
original: "非法符号——",
returned: [],
userQuery: "非法符号——",
returned: [],
error: "Unexpected `—` after `号` (not a valid identifier)",
}
]