zls
zls copied to clipboard
code completion in switch on tagged union has incorrect text edit
Zig Version
0.12.0-dev.3079+a1b083b66
Zig Language Server Version
0.12.0-dev.467+7e53a563
Client / Code Editor / Extensions
VS Code with vscode-zig
Steps to Reproduce and Observed Behavior
const E = union(enum) {
foo: []const u8,
bar,
baz,
};
test {
var e: E = undefined;
switch (e) {
.<cursor> // ask for completions here and select 'foo'
}
}
When snippets are enabled, the completion results in the following:
switch (e) {
.{ .foo = }
}
Expected Behavior
Complete to the following:
switch (e) {
.foo
}
Relevant log output
debug: (server): Took 0ms to process request-10-shutdown on Thread 943263
info : ( main ): Starting ZLS 0.12.0-dev.467+7e53a563 @ '/run/media/techatrix/UserFiles/zls/zig-out/bin/zls'
info : (server): set config option 'record_session_path' to '/run/media/techatrix/UserFiles/zls/record.zlsreplay'
info : (server): set config option 'global_cache_path' to '/home/techatrix/.cache/zls'
debug: (server): Took 0ms to process notification-exit on Thread 943263
info : (server): client is 'Visual Studio Code-1.84.2'
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 = true, .hover_supports_md = true, .signature_help_supports_md = true, .completion_doc_supports_md = true, .supports_completion_insert_replace_support = true, .supports_completion_deprecated_old = true, .supports_completion_deprecated_tag = true, .label_details_support = true, .supports_configuration = true, .supports_workspace_did_change_configuration_dynamic_registration = true, .supports_textDocument_definition_linkSupport = true, .max_detail_length = 1048576, .workspace_folders = { { 102, 105, 108, 101, 58, 47, 47, 47, 114, 117, 110, 47, 109, 101, 100, 105, 97, 47, 116, 101, 99, 104, 97, 116, 114, 105, 120, 47, 85, 115, 101, 114, 70, 105, 108, 101, 115, 47, 122, 108, 115 } } }
info : (server): offset encoding: utf-16
debug: (server): Took 0ms to process request-0-initialize on Thread 943310
debug: (server): Dynamically registering method 'workspace/didChangeConfiguration'
debug: (server): Took 0ms to process notification-initialized on Thread 943310
debug: (store ): Opened document `file:///run/media/techatrix/UserFiles/zls/testspace.zig`
debug: (server): Took 0ms to process notification-textDocument/didOpen on Thread 943310
debug: (server): Took 0ms to process response-register-workspace/didChangeConfiguration on Thread 943310
info : (server): set config option 'semantic_tokens' to 'Config.Config__enum_5272.partial'
info : (server): set config option 'builtin_path' to '/home/techatrix/.cache/zls/builtin.zig'
info : (server): set config option 'zig_lib_path' to '/nix/store/y1w1ssx25j3lfx5a7fql0jsypwr7fc3q-zig-0.12.0-dev.3079+a1b083b66/lib'
info : (server): set config option 'zig_exe_path' to '/nix/store/y1w1ssx25j3lfx5a7fql0jsypwr7fc3q-zig-0.12.0-dev.3079+a1b083b66/bin/zig'
info : (server): set config option 'build_runner_path' to '/home/techatrix/.cache/zls/build_runner_master.zig'
info : (server): set config option 'build_runner_global_cache_path' to '/home/techatrix/.cache/zig'
debug: (server): Took 14ms to process response-i_haz_configuration on Thread 943310
debug: (server): Took 0ms to process request-2-textDocument/codeAction on Thread 943311
debug: (server): Took 0ms to process request-1-textDocument/documentSymbol on Thread 943314
debug: (server): Took 0ms to process response-semantic_tokens_refresh on Thread 943310
debug: (server): Took 0ms to process request-3-textDocument/semanticTokens/full on Thread 943313
debug: (server): Took 0ms to process request-4-textDocument/codeAction on Thread 943311
debug: (server): Took 0ms to process request-5-textDocument/foldingRange on Thread 943314
debug: (server): Took 0ms to process request-6-textDocument/foldingRange on Thread 943313
debug: (server): Took 0ms to process request-7-textDocument/completion on Thread 943312
debug: (server): Took 0ms to process notification-textDocument/didChange on Thread 943310
debug: (server): Took 0ms to process request-8-textDocument/foldingRange on Thread 943314
debug: (server): Took 0ms to process request-9-textDocument/foldingRange on Thread 943313
debug: (server): Took 0ms to process request-10-textDocument/semanticTokens/full on Thread 943312
debug: (server): Took 0ms to process request-11-textDocument/documentSymbol on Thread 943311
debug: (server): Took 0ms to process request-12-shutdown on Thread 943310
debug: (server): Took 0ms to process notification-exit on Thread 943310