mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
autodoc: fix scoring bug when matching full decl name
This commit is contained in:
parent
35a8e8a06c
commit
97a1b046ea
@ -4328,9 +4328,9 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) {
|
||||
// shallow path are preferable
|
||||
const path_depth = canonPath.declNames.length * 50;
|
||||
// matching the start of a decl name is good
|
||||
const match_from_start = decl_name.startsWith(term) ? -term.length * (1 -ignoreCase) : (decl_name.length - term.length) + 1;
|
||||
const match_from_start = decl_name.startsWith(term) ? -term.length * (2 -ignoreCase) : (decl_name.length - term.length) + 1;
|
||||
// being a perfect match is good
|
||||
const is_full_match = (list == result.full) ? -decl_name.length * (2 - ignoreCase) : decl_name.length - term.length;
|
||||
const is_full_match = (decl_name === term) ? -decl_name.length * (1 - ignoreCase) : Math.abs(decl_name.length - term.length);
|
||||
// matching the end of a decl name is good
|
||||
const matches_the_end = decl_name.endsWith(term) ? -term.length * (1 - ignoreCase) : (decl_name.length - term.length) + 1;
|
||||
// explicitly penalizing scream case decls
|
||||
@ -4409,7 +4409,7 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) {
|
||||
|
||||
const href = navLink(canonPath.modNames, canonPath.declNames);
|
||||
|
||||
matchedItemsHTML += "<li><a href=\"" + href + "\">" + text + "</a></li>";
|
||||
matchedItemsHTML += "<li><a href=\"" + href + "\">" + text + "</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1630,8 +1630,6 @@ fn walkInstruction(
|
||||
|
||||
self.exprs.items[bin_index] = .{ .builtin = .{ .name = @tagName(tags[inst_index]), .param = rhs_index } };
|
||||
|
||||
std.debug.print("lhs: {any}\n\n", .{lhs});
|
||||
std.debug.print("lhs typeref: {any}\n\n", .{lhs.typeRef});
|
||||
return DocData.WalkResult{
|
||||
.typeRef = lhs.expr,
|
||||
.expr = .{ .builtinIndex = bin_index },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user