Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode extension overrides config.json options #229

Open
steeve opened this issue Sep 3, 2024 · 2 comments
Open

VSCode extension overrides config.json options #229

steeve opened this issue Sep 3, 2024 · 2 comments
Labels
lsp Issue with language server integration

Comments

@steeve
Copy link

steeve commented Sep 3, 2024

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 !

@Vexu Vexu added the lsp Issue with language server integration label Sep 3, 2024
@Techatrix
Copy link
Collaborator

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

@steeve
Copy link
Author

steeve commented Sep 10, 2024

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp Issue with language server integration
Projects
None yet
Development

No branches or pull requests

3 participants