Skip to content

Switching an enum does not autocomplete branch names #3202

@Sackaos

Description

@Sackaos

Zig Version

0.16.0

ZLS Version

0.16.0

Client / Code Editor / Extensions

VS code

Steps to Reproduce and Observed Behavior

Setup:

Vscode with Zig language extension (ziglang.vscode-zig, ver 0.6.18)

Code

open new project with zig init, copy paste this main.zig

pub fn main() !void {
    const a: MyEnum = .Asparagus;
    //                ^ this is working nicely

    const b = MyStruct{
        .t = .
        //   ^ this does not work
    };
    switch (a) {
        .
        // ^ this should start auto completing
    }
}

const MyStruct = struct {
    t: MyEnum,
};

const MyEnum = enum {
    Asparagus,
    Bat,
    CowManDog,
};

note: did not test in other code editors.

Expected Behavior

I expect the autocomplete to kick in after typing the . inside the switch, but i get nothing.
Note: auto complete in the variable declaration work nicely.

Attach ZLS log output

zls.log
2026-05-13 21:34:01.024 [info] Starting ZLS      0.16.0 @ 'c:\Users\Sackaos\AppData\Roaming\Code\User\globalStorage\ziglang.vscode-zig\zls\x86_64-windows-0.16.0\zls.exe'
2026-05-13 21:34:01.024 [info] Log File:         C:\Users\Sackaos\AppData\Local\Temp\zls\zls.log (info)
2026-05-13 21:34:01.026 [info] Client Info:      Visual Studio Code (1.120.0)
2026-05-13 21:34:01.034 [info] added Workspace Folder: file:///s:/Projects/Zig/zls-switch-tagged-union (2 files)
2026-05-13 21:34:01.039 [info] Loaded build file 'file:///s:/Projects/Zig/zls-switch-tagged-union/build.zig'
2026-05-13 21:34:01.039 [info] Server process exited successfully
2026-05-13 21:34:01.096 [info] Set config option 'semantic_tokens' to "partial"
2026-05-13 21:34:01.096 [info] Set config option 'builtin_path' to "C:\\Users\\Sackaos\\AppData\\Local\\Temp\\zls\\builtin.zig"
2026-05-13 21:34:01.096 [info] Set config option 'zig_lib_path' to "C:\\Users\\Sackaos\\.zvm\\0.16.0\\lib"
2026-05-13 21:34:01.096 [info] Set config option 'zig_exe_path' to "C:\\Users\\Sackaos\\.zvm\\0.16.0\\zig.exe"
2026-05-13 21:34:01.096 [info] Set config option 'build_runner_path' to "C:\\Users\\Sackaos\\AppData\\Local\\Temp\\zls\\build_runner\\0536d83f23cda18cf0a02d9cd4e6dce4\\build_runner.zig"
2026-05-13 21:34:01.096 [info] Set config option 'global_cache_path' to "C:\\Users\\Sackaos\\AppData\\Local\\Temp\\zls"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions