1 level deep imports now work but we crash when adding levels
This commit is contained in:
parent
31f1d2fa3e
commit
86d264f488
@ -209,6 +209,11 @@ pub const ImportContext = struct {
|
||||
handle: *Handle,
|
||||
trees: std.ArrayList(*std.zig.ast.Tree),
|
||||
|
||||
pub fn lastTree(self: *ImportContext) *std.zig.ast.Tree {
|
||||
std.debug.assert(self.trees.items.len > 0);
|
||||
return self.trees.items[self.trees.items.len - 1];
|
||||
}
|
||||
|
||||
pub fn onImport(self: *ImportContext, import_str: []const u8) !?*std.zig.ast.Node {
|
||||
const allocator = self.store.allocator;
|
||||
|
||||
|
@ -282,7 +282,7 @@ fn completeFieldAccess(id: i64, handle: *DocumentStore.Handle, position: types.P
|
||||
if (analysis.getFieldAccessTypeNode(tree, &tokenizer, &import_ctx)) |node| {
|
||||
var index: usize = 0;
|
||||
while (node.iterate(index)) |child_node| {
|
||||
if (try nodeToCompletion(&arena.allocator, tree, child_node, config)) |completion| {
|
||||
if (try nodeToCompletion(&arena.allocator, import_ctx.lastTree(), child_node, config)) |completion| {
|
||||
try completions.append(completion);
|
||||
}
|
||||
index += 1;
|
||||
|
Loading…
Reference in New Issue
Block a user