vscode-zig icon indicating copy to clipboard operation
vscode-zig copied to clipboard

VSCode extension overrides config.json options

Open steeve opened this issue 1 year ago • 11 comments

Hello

If ZLS is started with a custom config.json, unfortunately the extension will override the settings when sending its configuration.

Perhaps it could be possible to only send the keys that are set by the user ?

Here is a sample log:

info : ( main ): Starting ZLS 0.13.0 @ '../_main~repo~zls_aarch64-macos/zls'
info : (server): Client is 'Visual Studio Code-1.92.2'
info : (server): Set config option 'builtin_path' to '/private/var/tmp/zig-cache/builtin.zig'
info : (server): Set config option 'zig_lib_path' to '/private/var/tmp/_bazel_steeve/3a999f4335ba7d297daf0feac587c784/external/rules_zig~~zig~zig_0.14.0-dev.363_Pc3faae6bf_aarch64-macos/lib'
info : (server): Set config option 'zig_exe_path' to '/private/var/tmp/_bazel_steeve/3a999f4335ba7d297daf0feac587c784/execroot/_main/bazel-out/darwin_arm64-dbg/bin/third_party/zls/zls.zig_runner.sh'
info : (server): Set config option 'build_runner_path' to '/private/var/tmp/zig-cache/build_runner/21872970afd69e48a0847077e5196711/build_runner.zig'
info : (server): Set config option 'global_cache_path' to '/private/var/tmp/zig-cache' <-----------
info : (server): Set config option 'semantic_tokens' to 'partial'
info : (server): Set config option 'builtin_path' to '/Users/steeve/Library/Caches/zls/builtin.zig'
info : (server): Set config option 'zig_exe_path' to '/usr/bin/true'
info : (server): Set config option 'global_cache_path' to '/Users/steeve/Library/Caches/zls' <-----------

Thank you for this great extension !

steeve avatar Sep 03 '24 16:09 steeve

Could you clarify what you have set in your zls.json and VS Code settings.json? These 'simplified' logs are really confusing me...

Techatrix avatar Sep 08 '24 16:09 Techatrix

Due to running in a bazel sandbox, we actually set the zig path to the locally zig toolchain when starting ZLS inside its config.json (via a bazel runner).

It used to be that we could set a non existent path, vscode-zig would complain but at least it didn't override the ZLS options.

Now starting https://github.com/ziglang/vscode-zig/pull/222/files#diff-4af55eca91ea0a137b682c0a4f42fc9d6a8a6c56c9484f6974363204fa622f4aR14, because when that happens, that now prevents the whole extension from loading.

Same for global_cache_path.

zls.json

{
    "zig_lib_path": "/private/var/tmp/_bazel_steeve/3a999f4335ba7d297daf0feac587c784/execroot/_main/bazel-out/darwin_arm64-dbg/bin/third_party/zls/zls.zls_runner.sh.runfiles/rules_zig~~zig~zig_0.14.0-dev.363_Pc3faae6bf_aarch64-macos/lib",
    "zig_exe_path": "/private/var/tmp/_bazel_steeve/3a999f4335ba7d297daf0feac587c784/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/third_party/zls/zig.zig_runner.sh",
    "global_cache_path": "/private/var/tmp/zig-cache"
}

settings.json:

    "zig.formattingProvider": "zls",
    "zig.initialSetupDone": true,
    "zig.zls.path": "${workspaceFolder}/tools/zls.sh",

If we disable the formatting provider, the extension loads again but then we lose the formatting, which is kind of a big deal...

steeve avatar Sep 10 '24 21:09 steeve

The formatting issue should have been fixed by #233. The rest of the issue may be fixed by #252. Could you check whether that resolves your issue? Feel free to wait for the PR to merged and featured in the next release of the extension.


I assume that this issue is about zml. I would like to point out that the settings.json should be updated.

-    "zig.formattingProvider": "zls",
-    "zig.initialSetupDone": true,
    "zig.path": "${workspaceFolder}/tools/zig.sh",
-    "zig.zls.globalCachePath": null,
    "zig.zls.path": "${workspaceFolder}/tools/zls.sh",
  • zig.formattingProvider is "zls" by default.
  • zig.initialSetupDone has been removed.
  • The zig.zls.globalCachePath workaround should hopefully not be necessary with #252.

Not sure how this ties in with bazel and the rest of the project but may even go further and remove zig.zls.path because the extension can automatically install the appropriate ZLS version. You could also replace zig.path with zig.version. The extension will automatically install requested Zig version.

-    "zig.formattingProvider": "zls",
-    "zig.initialSetupDone": true,
-    "zig.path": "${workspaceFolder}/tools/zig.sh",
-    "zig.zls.globalCachePath": null,
-    "zig.zls.path": "${workspaceFolder}/tools/zls.sh",
+    "zig.version": "0.13.0",

You can find more information about the version management capabilities of the extension in #230.

Techatrix avatar Dec 09 '24 21:12 Techatrix

I've encountered this issue consistently. It's frustrating to constantly need to troubleshoot why settings aren't taking effect, only to discover that they're being overridden by the extension.

Pay attention to

Set config option 'semantic_tokens' to ...
Set config option 'inlay_hints_hide_redundant_param_names' to ...
Set config option 'inlay_hints_hide_redundant_param_names_last_token' to ...
Set config option 'highlight_global_var_declarations' to ...
[Info  - 1:16:48 PM] Starting ZLS      0.14.0-dev.406+336f468c @ '/home/rad/lab/z/zigscient/dev/zig-out/bin/zls'
[Info  - 1:16:48 PM] Log File:         /home/rad/.cache/zls/zls.log (debug)
[Info  - 1:16:48 PM] Client Info:      VSCodium-1.97.0
[Info  - 1:16:48 PM] Autofix Mode:     source.fixall
Offset Encoding:  utf-16
[Info  - 1:16:48 PM] added Workspace Folder: file:///home/rad/lab/z/zigscient/dev
[Info  - 1:16:48 PM] Loaded config:      /home/rad/.config/zls.json
[Info  - 1:16:48 PM] Set config option 'enable_build_on_save' to true
[Info  - 1:16:48 PM] Set config option 'semantic_tokens' to "none"
[Info  - 1:16:48 PM] Set config option 'inlay_hints_hide_redundant_param_names' to true
[Info  - 1:16:48 PM] Set config option 'inlay_hints_hide_redundant_param_names_last_token' to true
[Info  - 1:16:48 PM] Set config option 'warn_style' to true
[Info  - 1:16:48 PM] Set config option 'highlight_global_var_declarations' to true
[Info  - 1:16:48 PM] Set config option 'skip_std_references' to true
[Info  - 1:16:48 PM] Set config option 'prefer_ast_check_as_child_process' to false
[Info  - 1:16:48 PM] Set config option 'builtin_path' to "/home/rad/.cache/zls/builtin.zig"
[Info  - 1:16:48 PM] Set config option 'zig_lib_path' to "/home/rad/lab/zig/build/stage4/lib/zig"
[Info  - 1:16:48 PM] Set config option 'zig_exe_path' to "/home/rad/lab/zig/build/stage4/bin/zig"
[Info  - 1:16:48 PM] Set config option 'build_runner_path' to "/home/rad/.cache/zls/build_runner/9e5b9ae17ea1542863390dfab3c8a26c/build_runner.zig"
[Info  - 1:16:48 PM] Set config option 'global_cache_path' to "/home/rad/.cache/zls"
Took 11ms to process request-0-initialize on Thread 256368
Dynamically registering method 'workspace/didChangeConfiguration'
Took 0ms to process notification-initialized on Thread 256368
[Info  - 1:16:48 PM] Loaded build file 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/src/features/diagnostics.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/src/features/diagnostics.zig'
Took 3ms to process notification-textDocument/didOpen on Thread 256368
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/src/Server.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/src/Server.zig'
Took 5ms to process notification-textDocument/didOpen on Thread 256368
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/src/DocumentStore.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/src/DocumentStore.zig'
Took 2ms to process notification-textDocument/didOpen on Thread 256368
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/src/features/inlay_hints.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/src/features/inlay_hints.zig'
Took 2ms to process notification-textDocument/didOpen on Thread 256368
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/src/binned_allocator.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/src/binned_allocator.zig'
Took 1ms to process notification-textDocument/didOpen on Thread 256368
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/tests/lsp_features/inlay_hints.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/tests/lsp_features/inlay_hints.zig'
Took 1ms to process notification-textDocument/didOpen on Thread 256368
Took 0ms to process response-"register-workspace/didChangeConfiguration" on Thread 256368
[Info  - 1:16:49 PM] Set config option 'semantic_tokens' to "partial"
[Info  - 1:16:49 PM] Set config option 'inlay_hints_hide_redundant_param_names' to false
[Info  - 1:16:49 PM] Set config option 'inlay_hints_hide_redundant_param_names_last_token' to false
[Info  - 1:16:49 PM] Set config option 'highlight_global_var_declarations' to false
[Info  - 1:16:49 PM] Set config option 'skip_std_references' to false
[Info  - 1:16:49 PM] trying to start Build-On-Save for 'file:///home/rad/lab/z/zigscient/dev'
Took 5ms to process response-"i_haz_configuration" on Thread 256368
Took 0ms to process response-"progress" on Thread 256368
Took 0ms to process response-"semantic_tokens_refresh" on Thread 256368
Took 0ms to process response-"inlay_hints_refresh" on Thread 256368

Image

Image

llogick avatar Mar 03 '25 21:03 llogick

It's frustrating to constantly need to troubleshoot why settings aren't taking effect, only to discover that they're being overridden by the extension.

This issue should be fixed by fd95050f0a7f3f4c1ff628796760b9e4a055b8fe which has not yet been featured in a new release of the extension.

Techatrix avatar Mar 03 '25 21:03 Techatrix

0.6.5:

[Info  - 9:26:08 AM] Starting ZLS      0.14.0-dev.407+b9c9b5ab @ '/home/rad/lab/z/zigscient/dev/zig-out/bin/zigscient'
[Info  - 9:26:08 AM] Log File:         /home/rad/.cache/zls/zls.log (debug)
[Info  - 9:26:08 AM] Client Info:      VSCodium-1.97.0
[Info  - 9:26:08 AM] Autofix Mode:     source.fixall
Offset Encoding:  utf-16
[Info  - 9:26:08 AM] added Workspace Folder: file:///home/rad/lab/z/zigscient/dev
[Info  - 9:26:08 AM] Loaded config:      /home/rad/.config/zls.json
[Info  - 9:26:08 AM] Set config option 'enable_build_on_save' to true
[Info  - 9:26:08 AM] Set config option 'semantic_tokens' to "none"
[Info  - 9:26:08 AM] Set config option 'inlay_hints_hide_redundant_param_names' to true
[Info  - 9:26:08 AM] Set config option 'inlay_hints_hide_redundant_param_names_last_token' to true
[Info  - 9:26:08 AM] Set config option 'warn_style' to true
[Info  - 9:26:08 AM] Set config option 'highlight_global_var_declarations' to true
[Info  - 9:26:08 AM] Set config option 'skip_std_references' to true
[Info  - 9:26:08 AM] Set config option 'prefer_ast_check_as_child_process' to false
[Info  - 9:26:08 AM] Set config option 'builtin_path' to "/home/rad/.cache/zls/builtin.zig"
[Info  - 9:26:08 AM] Set config option 'zig_lib_path' to "/home/rad/lab/zig/build/stage4w/lib/zig"
[Info  - 9:26:08 AM] Set config option 'zig_exe_path' to "/home/rad/lab/zig/build/stage4w/bin/zig"
[Info  - 9:26:08 AM] Set config option 'build_runner_path' to "/home/rad/.cache/zls/build_runner/9e5b9ae17ea1542863390dfab3c8a26c/build_runner.zig"
[Info  - 9:26:08 AM] Set config option 'global_cache_path' to "/home/rad/.cache/zls"
Took 11ms to process request-0-initialize on Thread 70291
Dynamically registering method 'workspace/didChangeConfiguration'
Took 0ms to process notification-initialized on Thread 70291
[Info  - 9:26:08 AM] Loaded build file 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Resolved build file of 'file:///home/rad/lab/z/zigscient/dev/src/Server.zig' as 'file:///home/rad/lab/z/zigscient/dev/build.zig'
Opened document 'file:///home/rad/lab/z/zigscient/dev/src/Server.zig'
Took 4ms to process notification-textDocument/didOpen on Thread 70291
Opened document 'file:///home/rad/lab/z/zigscient/dev/build.zig.zon'
Took 0ms to process notification-textDocument/didOpen on Thread 70291
Took 0ms to process response-"register-workspace/didChangeConfiguration" on Thread 70291
[Info  - 9:26:08 AM] Set config option 'semantic_tokens' to "partial"
[Info  - 9:26:08 AM] Set config option 'zig_exe_path' to "/home/rad/lab/zig/build/stage4/bin/zig"
[Info  - 9:26:08 AM] trying to start Build-On-Save for 'file:///home/rad/lab/z/zigscient/dev'
Took 5ms to process response-"i_haz_configuration" on Thread 70291
Took 0ms to process response-"progress" on Thread 70291

The extension has an infuriating behavior when setting zig_exe_path. It insists on only accepting three values:

  • The literal string "zig"
  • An absolute path to the Zig executable
  • leaving the field blank => will cause it to install Zig without warning or consent, no questions asked, no way to cancel the installation

OP didn't make it a point, but you can see in their post that zig_exe_path is being overridden as well.

llogick avatar Mar 05 '25 17:03 llogick

Could you elaborate on whether the logs you have posted are indicating that the LSP is setup as expected or not. I am a bit confused about how there is stage4w/bin/zig and stage4/bin/zig. It's not easy to tell what is going on without knowing what is the $PATH, zls.json and settings.json.

Apart from the issues I have already referenced here, there is an issue with how editor config and the zls.json work to resolve the zig executable path: Both the ZLS and the vscode extension itself want access to a zig executable. ZLS can be provided a zig executable through the zls.json but the extension has no knowledge of that which means that it will try to find or install a zig executable by itself and then inform ZLS about it. I believe that you and OP have both this issue. To verify I would need to know what exactly is specified in $PATH, zls.json and settings.json.

It insists on only accepting three values:

Is there something concrete that you are missing here? Without more information I could only guess or list all the version management features of the extension. Maybe predefined variables to specify a relative path? Or do just not want it automatically install Zig?

Techatrix avatar Mar 07 '25 17:03 Techatrix

Both the ZLS and the vscode extension itself want access to a zig executable. ZLS can be provided a zig executable through the zls.json but the extension has no knowledge of that which means that it will try to find or install a zig executable by itself and then inform ZLS about it.

Yes, the disconnect between them is the issue.

My zls.json

{
  "$schema": "https://raw.githubusercontent.com/zigtools/zls/master/schema.json",
  "11zig_exe_path": "/home/rad/Downloads/zig-linux-x86_64-0.11.0/zig",
  "12zig_exe_path": "/home/rad/Downloads/zig-linux-x86_64-0.12.0/zig",
  "12build_runner_path": "/home/rad/lab/z/zigscient/dev/src/build_runner/0.12.0.zig",
  "13zig_exe_path": "/home/rad/Downloads/zig-linux-x86_64-0.13.0/zig",
  "3zig_exe_path": "/home/rad/lab/zig/build/stage3/bin/zig",
  "zig_exe_path": "/home/rad/lab/zig/build/stage4/bin/zig",
  "4zig_exe_path": "/home/rad/lab/zig/build/stage4w/bin/zig",
  "enable_build_on_save": true,
  "enable_snippets": true,
  "enable_ast_check_diagnostics": true,
  "enable_autofix": true,
  "enable_import_embedfile_argument_completions": true,
  "warn_style": true,
  "semantic_tokens": "none",
  "enable_inlay_hints": true,
  "inlay_hints_show_variable_type_hints": true,
  "1inlay_hints_show_parameter_name": false,
  "1inlay_hints_param_hint_kind": "type",
  "1inlay_hints_show_builtin": true,
  "1inlay_hints_exclude_single_argument": true,
  "inlay_hints_hide_redundant_param_names": true,
  "inlay_hints_hide_redundant_param_names_last_token": true,
  "operator_completions": true,
  "include_at_in_builtins": false,
  "max_detail_length": 1048576,
  "skip_std_references": true,
  "highlight_global_var_declarations": true,
  "dangerous_comptime_experiments_do_not_enable": false,
  "prefer_ast_check_as_child_process": false,
  "analysis_backend": "astgen_analyser"
}

I take advantage that unknown fields are ignored, and can quickly switch between zig versions. (at the time stage4 was Zig 0.14.0 and stage4w was 0.14.0-dev.3467+c76f451ab)

/home/rad/lab/zig/build/stage4/bin is in my shell(s) $PATH

My settings.json

{
    "window.zoomLevel": 2,
    "terminal.integrated.env.linux": {
        "PATH": "/home/rad/lab/zig/build/stage4/bin:${env:PATH}"
    },
    "editor.largeFileOptimizations": false,
    "update.mode": "manual",
    "editor.fontLigatures": false,
    "git.openRepositoryInParentFolders": "never",
    "editor.minimap.autohide": true,
    "editor.minimap.scale": 3,
    "editor.rulers": [
        80,
        100,
        120,
        140
    ],
    "redhat.telemetry.enabled": false,
    "editor.minimap.enabled": false,
    "window.titleBarStyle": "custom",
    "editor.guides.bracketPairs": "active",
    "diffEditor.ignoreTrimWhitespace": false,
    "files.insertFinalNewline": true,
    "go.survey.prompt": false,
    "go.trace.server": "messages",
    "diffEditor.codeLens": true,
    "terminal.integrated.scrollback": 100000,
    "workbench.sideBar.location": "right",
    "editor.codeActionsOnSave": {},
    "zig.zls.path": "/home/rad/lab/z/zigscient/dev/zig-out/bin/zigscient",
    // All nested settings will only affect Zig files.
    "[zig]": {
        // Formatting with ZLS matches `zig fmt`.
        // The Zig FAQ answers some questions about `zig fmt`:
        // https://github.com/ziglang/zig/wiki/FAQ
        //
        // disable format-on-save
        // "editor.formatOnSave": false,
        // disable inlay hints
        // "editor.inlayHints.enabled": "off",
        // overwrite words when accepting completions
        "editor.suggest.insertMode": "replace",
        // The `foldingProviderModel` provides more accurate stick scroll scopes
        // "editor.stickyScroll.defaultModel": "foldingProviderModel",
        "editor.codeActionsOnSave": {
            // Run code actions that currently supports adding and removing discards.
            "source.fixAll": "explicit",
            // Run code actions that sorts @import declarations.
            // Available since ZLS `0.14.0-dev.188+2be424de5`
            // "source.organizeImports": "explicit",
        }
    },
    "zig.zls.preferAstCheckAsChildProcess": false,
    "zig.zls.debugLog": true,
    "zig.zls.enabled": "on",
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        }
    },
    "git-graph.integratedTerminalShell": "/usr/bin/fish",
    "terminal.integrated.automationProfile.linux": {
        "path": "/usr/bin/fish"
    },
    "zig.zls.warnStyle": true,
    "zig.path": "zig",
}

Say I'd like to use zig 0.13.0 edit zls.json

  "zig_exe_path": "/home/rad/Downloads/zig-linux-x86_64-0.13.0/zig",
  "4zig_exe_path": "/home/rad/lab/zig/build/stage4/bin/zig",
Took 0ms to process request-16-shutdown on Thread 129619
[Info  - 9:50:59 AM] Starting ZLS      0.15.0-dev.423+2dfd6d6a @ '/home/rad/lab/z/zigscient/dev/zig-out/bin/zigscient'
[Info  - 9:50:59 AM] Log File:         /home/rad/.cache/zls/zls.log (debug)
[Info  - 9:50:59 AM] Client Info:      VSCodium-1.97.0
[Info  - 9:50:59 AM] Autofix Mode:     source.fixall
Offset Encoding:  utf-16
[Info  - 9:50:59 AM] added Workspace Folder: file:///home/rad/lab/microzig/examples/raspberrypi/rp2xxx
[Info  - 9:50:59 AM] Loaded config:      /home/rad/.config/zls.json
[Info  - 9:50:59 AM] Set config option 'enable_build_on_save' to true
[Info  - 9:50:59 AM] Set config option 'semantic_tokens' to "none"
[Info  - 9:50:59 AM] Set config option 'inlay_hints_hide_redundant_param_names' to true
[Info  - 9:50:59 AM] Set config option 'inlay_hints_hide_redundant_param_names_last_token' to true
[Info  - 9:50:59 AM] Set config option 'warn_style' to true
[Info  - 9:50:59 AM] Set config option 'highlight_global_var_declarations' to true
[Info  - 9:50:59 AM] Set config option 'skip_std_references' to true
[Info  - 9:50:59 AM] Set config option 'prefer_ast_check_as_child_process' to false
[Info  - 9:50:59 AM] Set config option 'builtin_path' to "/home/rad/.cache/zls/builtin.zig"
[Info  - 9:50:59 AM] Set config option 'zig_lib_path' to "/home/rad/Downloads/zig-linux-x86_64-0.13.0/lib"
[Info  - 9:50:59 AM] Set config option 'zig_exe_path' to "/home/rad/Downloads/zig-linux-x86_64-0.13.0/zig"
[Info  - 9:50:59 AM] Set config option 'global_cache_path' to "/home/rad/.cache/zls"
Took 7ms to process request-0-initialize on Thread 130337
Dynamically registering method 'workspace/didChangeConfiguration'
Took 0ms to process notification-initialized on Thread 130337
[Info  - 9:50:59 AM] Loaded build file 'file:///home/rad/lab/microzig/examples/raspberrypi/rp2xxx/build.zig'
[Info  - 9:50:59 AM] Loaded build file 'file:///home/rad/lab/microzig/examples/build.zig'
[Info  - 9:50:59 AM] Loaded build file 'file:///home/rad/lab/microzig/build.zig'
Opened document 'file:///home/rad/lab/microzig/examples/raspberrypi/rp2xxx/src/blinky.zig'
Took 0ms to process notification-textDocument/didOpen on Thread 130337
Took 0ms to process response-"register-workspace/didChangeConfiguration" on Thread 130337
[Info  - 9:50:59 AM] Set config option 'semantic_tokens' to "partial"
[Info  - 9:50:59 AM] Set config option 'zig_exe_path' to "/home/rad/lab/zig/build/stage4/bin/zig"
[Info  - 9:50:59 AM] Set config option 'build_runner_path' to "/home/rad/.cache/zls/build_runner/66ed948cb34b142db738951608c6140d/build_runner.zig"
[Info  - 9:50:59 AM] trying to start Build-On-Save for 'file:///home/rad/lab/microzig/examples/raspberrypi/rp2xxx'
Took 5ms to process response-"i_haz_configuration" on Thread 130337
Took 0ms to process request-2-textDocument/codeAction on Thread 130337
Took 1ms to process request-1-textDocument/documentSymbol on Thread 130338
Took 0ms to process response-"progress" on Thread 130337
zig build runner process has exited
[Error - 9:50:59 AM] Failed to execute build runner to collect build configuration, command:
/home/rad/lab/zig/build/stage4/bin/zig build --build-runner /home/rad/.cache/zls/build_runner/66ed948cb34b142db738951608c6140d/build_runner.zig --zig-lib-dir /home/rad/Downloads/zig-linux-x86_64-0.13.0/lib
Error: /home/rad/lab/microzig/build.zig.zon:2:13: error: expected enum literal
    .name = "microzig",
            ^~~~~~~~~~

[Error - 9:50:59 AM] Failed to execute build runner to collect build configuration, command:
/home/rad/lab/zig/build/stage4/bin/zig build --build-runner /home/rad/.cache/zls/build_runner/66ed948cb34b142db738951608c6140d/build_runner.zig --zig-lib-dir /home/rad/Downloads/zig-linux-x86_64-0.13.0/lib
Error: /home/rad/lab/microzig/examples/build.zig.zon:2:13: error: expected enum literal
    .name = "examples",
            ^~~~~~~~~~

[Error - 9:50:59 AM] Failed to execute build runner to collect build configuration, command:
/home/rad/lab/zig/build/stage4/bin/zig build --build-runner /home/rad/.cache/zls/build_runner/66ed948cb34b142db738951608c6140d/build_runner.zig --zig-lib-dir /home/rad/Downloads/zig-linux-x86_64-0.13.0/lib
Error: /home/rad/lab/microzig/examples/raspberrypi/rp2xxx/build.zig.zon:2:13: error: expected enum literal
    .name = "examples/raspberrypi/rp2xxx",
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[Error - 9:50:59 AM] Failed to load build configuration for file:///home/rad/lab/microzig/examples/raspberrypi/rp2xxx/build.zig (error: error.RunFailed)
[Error - 9:50:59 AM] Failed to load build configuration for file:///home/rad/lab/microzig/examples/build.zig (error: error.RunFailed)
[Error - 9:50:59 AM] Failed to load build configuration for file:///home/rad/lab/microzig/build.zig (error: error.RunFailed)
Opened document 'file:///home/rad/Downloads/zig-linux-x86_64-0.13.0/lib/std/std.zig'
Took 5ms to process request-3-textDocument/inlayHint on Thread 130338
Took 0ms to process request-4-textDocument/codeAction on Thread 130340
Took 0ms to process request-5-textDocument/semanticTokens/range on Thread 130339
Took 0ms to process request-6-textDocument/foldingRange on Thread 130341
Took 0ms to process request-7-textDocument/hover on Thread 130338
Took 0ms to process request-8-textDocument/codeAction on Thread 130340
Took 0ms to process request-9-textDocument/hover on Thread 130339
Took 0ms to process request-10-textDocument/hover on Thread 130341
Took 0ms to process request-11-textDocument/inlayHint on Thread 130338
Took 0ms to process request-12-textDocument/semanticTokens/range on Thread 130340
Took 0ms to process request-13-textDocument/inlayHint on Thread 130339
Took 0ms to process request-14-textDocument/semanticTokens/range on Thread 130341
Took 0ms to process request-15-textDocument/inlayHint on Thread 130338
Took 0ms to process request-16-textDocument/semanticTokens/range on Thread 130340
Took 0ms to process request-17-textDocument/codeAction on Thread 130339
Took 0ms to process notification-other on Thread 130337
Took 0ms to process notification-workspace/didChangeConfiguration on Thread 130337
Took 3ms to process response-"i_haz_configuration" on Thread 130337

llogick avatar Mar 07 '25 18:03 llogick

Would it no suffice to move the zig_exe_path setting from the zls.json to the settings.json? The latter also allows you to comment out the unused versions.

Techatrix avatar Mar 07 '25 19:03 Techatrix

Would it no suffice to move the zig_exe_path setting from the zls.json to the settings.json? The latter also allows you to comment out the unused versions.

Yes, I've arrived at that conclusion 😁 , it was just neater using the .json file when ensuring server functionality with multiple editors. (I guess OP would have to ship a custom/modified/modify settings.json)

For completeness sake: the other setting that gets ignored is semantic_tokens, no biggie, but it likely means 'can't use zls.json to set any enum-type settings'

llogick avatar Mar 07 '25 19:03 llogick

it was just neater using the .json file when ensuring server functionality with multiple editors.

True, that is a nice advantage when using multiple editors. But besides that, based on my personal experience, I've generally had a better time when I removed my zls.json and only relied on editor's configuration. You have to setup some configuration for you editor anyway so getting rid of the zls.json is just one less file that needs to be managed. Many other LSPs only support in-editor configuration as opposed to having their own config file which would make it more consistent.

I guess OP would have to ship a custom/modified/modify settings.json

AFAICT OP is having this issue with the zml project which has a workspace settings.json so it should be possible to set the zig_exe_path/zig.path in there even though I am not entirely sure why it contains "zig.path": "x".

the other setting that gets ignored is semantic_tokens, no biggie, but it likely means 'can't use zls.json to set any enum-type settings'

This one is kind of intentional. The extension has "partial" as the default value for semantic_tokens because it has been observed to give better results. Similar to the issue with zig_exe_path/zig.path, it still gets overridden if explicitly specified in zls.json.

Techatrix avatar Mar 07 '25 19:03 Techatrix