summaryrefslogtreecommitdiff
path: root/core/Query.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Query.zig')
-rw-r--r--core/Query.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/Query.zig b/core/Query.zig
index 743e9540..a5926e23 100644
--- a/core/Query.zig
+++ b/core/Query.zig
@@ -785,7 +785,8 @@ pub fn gather(p: *Pardes, names: *Names, source: Source, dir: []const u8, self:
// line, its mark, its name qualified by the ones it is in, then
// what its first line says after the name; types, functions,
// fields, then the rest, each in the text's order (UX DESIGN N).
- // The name alone is matched.
+ // The qualified name alone is matched, its own name the
+ // basename.
for (0..4) |group| for (symbols) |sym| {
if (sym.kind.group() != group or sym.kind == .scope or sym.end > text.len) continue;
var buf: [512]u8 = undefined;
@@ -793,13 +794,15 @@ pub fn gather(p: *Pardes, names: *Names, source: Source, dir: []const u8, self:
row.print("{d: >6} {s} ", .{ sym.line + 1, sym.kind.mark() }) catch continue;
const key_at = row.end;
qualify(&row, symbols, text, sym.parent, 4) catch continue;
+ // The name its basename: the qualifier dim (Pick.rowAt).
+ const base = row.end - key_at;
row.writeAll(text[sym.name_start..sym.name_end]) catch continue;
const key_len = row.end - key_at;
const rest = text[sym.name_end..@max(sym.name_end, sym.end)];
var detail = std.mem.trim(u8, rest[0 .. std.mem.indexOfScalar(u8, rest, '\n') orelse rest.len], " \t\r");
detail = std.mem.trimEnd(u8, std.mem.trimEnd(u8, detail, "{,;"), " \t");
if (detail.len > 0) row.print(" {s}", .{detail[0..@min(detail.len, buf.len - row.end -| 2)]}) catch {};
- names.add(gpa, row.buffered(), key_at, key_len, 0, sym.line + 1) catch break;
+ names.add(gpa, row.buffered(), key_at, key_len, @intCast(base), sym.line + 1) catch break;
names.cands.items[names.cands.items.len - 1].group = @intCast(group);
};
},