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

rework config system #1366

Merged
merged 9 commits into from
Aug 13, 2023
Merged

rework config system #1366

merged 9 commits into from
Aug 13, 2023

Conversation

Techatrix
Copy link
Member

@Techatrix Techatrix commented Jul 30, 2023

Since configuration can be very sensible to changes it may be better to hold these changes back until after the 0.11.0 release.

These changes move some of the configuration setup into the initialize request which allows sending messages about bad config options that show up in the user interface (in VS-Code at least).
Screenshot from 2023-07-30 09-53-20

fixes #1251
fixes #1238
fixes #1129
fixes #994
fixes #1104

@Techatrix Techatrix force-pushed the config-v2 branch 2 times, most recently from 0618097 to 92e1137 Compare August 1, 2023 05:09
Comment on lines +866 to +869
if (!std.fs.path.isAbsolute(path)) {
server.showMessage(.Warning, "config option '{s}': expected absolute path but got '{s}'", .{ field_name, path });
break :ok false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using "zig" as the zig path in order to use the zig in the PATH causes this check to fail, even though that works perfectly fine.

Other than that minor annoyance this PR looks good.

@Techatrix Techatrix merged commit 2dbfcd5 into zigtools:master Aug 13, 2023
4 checks passed
@Techatrix Techatrix deleted the config-v2 branch August 13, 2023 12:22
log.info("Using offset encoding: {s}", .{@tagName(server.offset_encoding)});
log.info("offset encoding: {s}", .{@tagName(server.offset_encoding)});

server.updateConfiguration(.{}) catch |err| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would seem that the .{} param here invalidates some of the zls.json settings?
Causes try server.resolveConfiguration(config_arena, &new_cfg); to reevaluate the corresponding ?const []u8s as if they haven't been set.

[Trace - 2:49:05 PM] Sending request 'initialize - (0)'.
info : ( main ): Enabled debug logging.
info : ( main ): Starting ZLS 0.12.0-dev.17+4c3236b @ '/home/rad/lab/zls/npdm/zig-out/bin/zls'
info : (server): set config option 'semantic_tokens' to 'Config.Config__enum_5911.none' // Custom
info : (server): set config option 'warn_style' to 'true' // Custom
info : (server): set config option 'highlight_global_var_declarations' to 'true' // Custom
info : (server): set config option 'skip_std_references' to 'true' // Custom
info : (server): set config option 'prefer_ast_check_as_child_process' to 'false' // Custom
info : (server): set config option 'builtin_path' to '/home/rad/.cache/zls/builtin.zig' // Auto
info : (server): set config option 'zig_lib_path' to '/home/rad/lab/zig/build/stage3/lib/zig' // Auto
info : (server): set config option 'zig_exe_path' to '/home/rad/lab/zig/build/stage3/bin/zig' // Custom
info : (server): set config option 'build_runner_path' to '/home/rad/.cache/zls/build_runner.zig' // Auto
info : (server): set config option 'global_cache_path' to '/home/rad/.cache/zls' // Auto
info : (server): set config option 'build_runner_global_cache_path' to '/home/rad/.cache/zig' // Auto
info : (server): client is 'VSCodium-1.81.0'
info : (server): Server.ClientCapabilities{ .supports_snippets = true, .supports_apply_edits = true, .supports_will_save = true, .supports_will_save_wait_until = true, .supports_publish_diagnostics = true, .supports_code_action_fixall = false, .hover_supports_md = true, .completion_doc_supports_md = true, .label_details_support = true, .supports_configuration = true, .supports_workspace_did_change_configuration_dynamic_registration = true, .supports_textDocument_definition_linkSupport = true }
info : (server): offset encoding: utf-16
info : (server): set config option 'zig_lib_path' to '/home/rad/lab/zig/lib' // Auto
info : (server): set config option 'zig_exe_path' to '/home/rad/lab/zig/build/stage4/bin/zig' // Auto from PATH

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does #1404 resolve your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants