Skip to content

VSCode + ZLS unable to get type information for addImport modules on Bazzite/Fedora Atomic with relative paths on workspaces #2657

@silbinarywolf

Description

@silbinarywolf

Zig Version

0.16.0-dev.2915+065c6e794

ZLS Version

0.16.0-dev.280+3ec65a81

Client / Code Editor / Extensions

VSCodium + Zig Extension

Steps to Reproduce and Observed Behavior

tldr: VSCode loading relative workspaces is broken, at least on Fedora Atomic / Bazzite. The workspace needs the full path with a /var/ prefix or addImport modules will not work with ZLS, only the standard library imports will work.

  • /var/home/jae/Documents/ZigProjects/impeticos = works
  • /home/jae/Documents/ZigProjects/impeticos = broken
  • ../ZigProjects/impeticos = broken

For example, if the path to my project looks like the following in my workspace file such as zig-android-sdk.code-workspace, then the Zig Language Server will *partially* work, and only autocomplete the @import("std")` import.

{
	"folders": [
		{
			"path": "../ZigProjects/impeticos"
		}
	]
}

or:

{
    "folders": [
        {
            "path": "/home/jae/Documents/ZigProjects/impeticos"
        }
    ]
}

However, if I manually edit my workspace to include the /var/ prefix and then close any previously remembered open files (re-open them), it "corrects" the path and then my module imports will have their types determined again by ZLS.

{
    "folders": [
        {
            "path": "/var/home/jae/Documents/ZigProjects/impeticos"
        }
    ]
}
Image

Example of having main.zig previously open before "fixing" the path manually to have /var/home/ prefix

Image

Example of after closing main.zig tab and re-opening, we now have working imported modules

Other notes

  • I was unable to see / observe this strange behaviour in Zed on Bazzite/Linux
  • I was unable to observe this on Windows with VSCode.

Reproducibility

For example, even this file here cannot resolve the type of the android import.
github.com/silbinarywolf/zig-android-sdk/blob/b1bef7e5069e5911a5942f262a00eb57e05b470d/examples/minimal/src/minimal.zig#L3

const std = @import("std");
const builtin = @import("builtin");
const android = @import("android"); // <- unknown type
const androidbind = @import("android-bind.zig");
const log = std.log;

In this case here, the import looks like:

.{
    .name = .minimal,
    .version = "0.0.0",
    .dependencies = .{
        .android = .{
            .path = "../..",
        },
    },

Expected Behavior

I expect ZLS to work regardless of whether how I open the file. My best guess is that it needs an exact match to the absolute filename or something but I don't really get enough information from logs

Attach ZLS log output

Broken Version

zls.log
2026-03-19 12:37:08.547 [info] Starting ZLS      0.16.0-dev.280+3ec65a81 @ '/home/jae/Documents/zig/zls/zig-out/bin/zls'
2026-03-19 12:37:08.547 [info] Log File:         /home/jae/.cache/zls/zls.log (info)
2026-03-19 12:37:08.547 [info] Client Info:      VSCodium (1.110.1)
2026-03-19 12:37:08.547 [info] added Workspace Folder: file:///home/jae/Documents/ZigProjects/impeticos (125 files)
2026-03-19 12:37:08.565 [info] Set config option 'semantic_tokens' to "partial"
2026-03-19 12:37:08.565 [info] Set config option 'builtin_path' to "/var/home/jae/.cache/zls/builtin.zig"
2026-03-19 12:37:08.565 [info] Set config option 'zig_lib_path' to "/var/home/jae/Documents/zig/current/lib"
2026-03-19 12:37:08.565 [info] Set config option 'zig_exe_path' to "/var/home/jae/Documents/zig/current/zig"
2026-03-19 12:37:08.565 [info] Set config option 'build_runner_path' to "/var/home/jae/.cache/zls/build_runner/ce59395e261114991320dab804361289/build_runner.zig"
2026-03-19 12:37:08.565 [info] Set config option 'global_cache_path' to "/var/home/jae/.cache/zls"
2026-03-19 12:37:10.981 [info] Loaded build file 'file:///home/jae/Documents/ZigProjects/impeticos/build.zig'

Fixed Version

zls.log
2026-03-19 12:41:05.554 [info] Starting ZLS      0.16.0-dev.280+3ec65a81 @ '/home/jae/Documents/zig/zls/zig-out/bin/zls'
2026-03-19 12:41:05.554 [info] Log File:         /home/jae/.cache/zls/zls.log (info)
2026-03-19 12:41:05.554 [info] Client Info:      VSCodium (1.110.1)
2026-03-19 12:41:05.554 [info] added Workspace Folder: file:///var/home/jae/Documents/ZigProjects/impeticos (125 files)
2026-03-19 12:41:05.554 [info] Set config option 'semantic_tokens' to "partial"
2026-03-19 12:41:05.554 [info] Set config option 'builtin_path' to "/var/home/jae/.cache/zls/builtin.zig"
2026-03-19 12:41:05.554 [info] Set config option 'zig_lib_path' to "/var/home/jae/Documents/zig/current/lib"
2026-03-19 12:41:05.556 [info] Set config option 'zig_exe_path' to "/var/home/jae/Documents/zig/current/zig"
2026-03-19 12:41:05.556 [info] Set config option 'build_runner_path' to "/var/home/jae/.cache/zls/build_runner/ce59395e261114991320dab804361289/build_runner.zig"
2026-03-19 12:41:05.566 [info] Set config option 'global_cache_path' to "/var/home/jae/.cache/zls"
2026-03-19 12:41:05.575 [info] Loaded build file 'file:///home/jae/Documents/ZigProjects/impeticos/build.zig'
2026-03-19 12:41:12.048 [info] Loaded build file 'file:///var/home/jae/Documents/ZigProjects/impeticos/build.zig'

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