Skip to content

No dot completion for helix + vulkan #3171

@ethernetsellout

Description

@ethernetsellout

Zig Version

0.16.0-dev.3146+0606af509

ZLS Version

0.16.0-dev.300+f391142c

Client / Code Editor / Extensions

helix

Steps to Reproduce and Observed Behavior

I try to do dot completion, e.g. vk.BaseWrapper, but nothing happens when using helix. Strangely it appears to work on kate.

build.zig:

const std = @import("std");

fn build_exe(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Step.Compile {
    const exe = b.addExecutable(.{
        .name = "triangle",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize
        }),
    });

    const headers = b.dependency("vulkan_headers", .{});

    const vulkan_dep = b.dependency("vulkan", .{
        .target = target,
        .optimize = optimize,
        .registry = headers.path("registry/vk.xml")
    });

    const vulkan = vulkan_dep.module("vulkan-zig");

    exe.root_module.addImport("vulkan", vulkan);

    const glfw_dep = b.dependency("glfw", .{
        .target = target,
        .optimize = optimize,
        .shared = if (optimize == .Debug) true else null
    });

    const glfw_lib = glfw_dep.artifact("glfw");

    exe.root_module.linkLibrary(glfw_lib);

    return exe;
}

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = build_exe(b, target, optimize);

    b.installArtifact(exe);

    const exe_check = build_exe(b, target, optimize);

    const check = b.step("check", "Check if the executable compiles");
    check.dependOn(&exe_check.step);

    const run_step = b.step("run", "Run the app");

    const run_cmd = b.addRunArtifact(exe);
    run_step.dependOn(&run_cmd.step);

    run_cmd.step.dependOn(b.getInstallStep());

    if (b.args) |args| {
        run_cmd.addArgs(args);
    }
}

build.zig.zon:

.{
    .name = .triangle,
    .version = "0.0.0",
    .fingerprint = 0xdf976d87801c5fcc,
    .minimum_zig_version = "0.16.0-dev.2937+c38e6ed68",
    .dependencies = .{
        .vulkan = .{
            .url = "git+https://github.com/Snektron/vulkan-zig#b3086a867a47bb10e66a987a38115a43056b60f7",
            .hash = "vulkan-0.0.0-r7Ytx99oAwDmJu0XtvukW_bSYnAv1PpbPO9ZFwsjcPPO",
        },
        .vulkan_headers = .{
            .url = "git+https://github.com/KhronosGroup/Vulkan-Headers#afe9eb980aa928a66d1c9c06f38c55dd59868720",
            .hash = "N-V-__8AAPwhagKzo63CN9Xp9fZgDF34VxO0bJWvZ8XUcNZA",
        },
        .glfw = .{
            .url = "git+https://github.com/allyourcodebase/glfw#79e7ba3d082765954b59c4f11a2f9b4ff1ecb350",
            .hash = "glfw-0.0.0-R5AeUo0JGgBvENV2Oz-u0V_unpWhEJTfK4qckBH5da6e",
        },
    },
    .paths = .{
        "build.zig",
        "build.zig.zon",
        "src",
    },
}

src/main.zig:

const std = @import("std");

const vk = @import("vulkan");

pub fn main() void {
    _ = vk.BaseWrapper; // no completion
}

Expected Behavior

Dot completion to work

Attach ZLS 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