From 511e1f8192bb4802c1071d19d3b9620232898b87 Mon Sep 17 00:00:00 2001 From: nullptrdevs <16590917+nullptrdevs@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:26:00 -0700 Subject: [PATCH] HACK? Look for mod imports in any handle's build file --- src/DocumentStore.zig | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/DocumentStore.zig b/src/DocumentStore.zig index 92a6141531..c55e161118 100644 --- a/src/DocumentStore.zig +++ b/src/DocumentStore.zig @@ -1327,12 +1327,16 @@ pub fn uriFromImportStr(self: *DocumentStore, allocator: std.mem.Allocator, hand } return null; } else if (!std.mem.endsWith(u8, import_str, ".zig")) { - if (handle.associated_build_file) |build_file_uri| blk: { - const build_file = self.getBuildFile(build_file_uri).?; - const config = build_file.config orelse break :blk; - for (config.value.packages) |pkg| { - if (std.mem.eql(u8, import_str, pkg.name)) { - return try URI.fromPath(allocator, pkg.path); + self.lock.lockShared(); + defer self.lock.unlockShared(); + for (self.handles.values()) |h| { + if (h.associated_build_file) |build_file_uri| blk: { + const build_file = self.getBuildFile(build_file_uri).?; + const config = build_file.config orelse break :blk; + for (config.value.packages) |pkg| { + if (std.mem.eql(u8, import_str, pkg.name)) { + return try URI.fromPath(allocator, pkg.path); + } } } }