Skip to content

Commit

Permalink
HACK? Look for mod imports in any handle's build file
Browse files Browse the repository at this point in the history
  • Loading branch information
llogick committed Oct 31, 2023
1 parent 14ba967 commit 511e1f8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/DocumentStore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 511e1f8

Please sign in to comment.