Skip to content

Module self imports not recognized by ZLS #2117

@Trevor-Strong

Description

@Trevor-Strong

Zig Version

0.14.0-dev.2547+77c63ac36

ZLS Version

0.14.0-dev.304+b401aab

Client / Code Editor / Extensions

VSCode with Zig Language extension

Steps to Reproduce and Observed Behavior

// build.zig
const std = @import("std");

pub fn build(b: *std.Build) void {

    const module = b.addModule("z", .{
        .target = b.graph.host,
        .optimize = .Debug,
        .root_source_file = b.path("z.zig"),
    });
    module.addImport("z", module);

    const unit_tests = b.addTest(.{ .root_module = module });

    const run_unit_tests = b.addRunArtifact(unit_tests);
    const test_step = b.step("test", "Run unit tests");
    test_step.dependOn(&run_unit_tests.step);
}
// z.zig
const std = @import("std");
const z = @import("z");

comptime {
    std.debug.assert(z == @This());
}

test {
    std.testing.refAllDecls(@This());
}

After running zig build test:
no-import-types-zls-repro

Expected Behavior

I would expect that there be type hints for the import, like there was before.

I only encountered this issue after upgrading from a previous 0.14.0-dev version of zig to the version list in this issue.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions