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

Cannot rename enum fields using VSCode extension. #2042

Closed
smallkirby opened this issue Oct 1, 2024 · 3 comments · Fixed by #2043
Closed

Cannot rename enum fields using VSCode extension. #2042

smallkirby opened this issue Oct 1, 2024 · 3 comments · Fixed by #2043
Labels
bug Something isn't working

Comments

@smallkirby
Copy link

smallkirby commented Oct 1, 2024

Zig Version

0.13.0

ZLS Version

0.13.0

Client / Code Editor / Extensions

Visual Studio Code-1.93.1

Steps to Reproduce and Observed Behavior

Init new project with zig init.
Edit main.zig as follows:

const std = @import("std");

pub const SomeEnum = enum {
    zero,
    one,
};

pub fn main() !void {
    const se = SomeEnum.one;
    std.log.debug("se: {?}", .{se});
}

Right click (or Ctrl+R) the field of enum SomeEnum, for example zero, to rename. Enter new name and press enter. Popup appears at the right bottom of VSCode saying that Rename failed to apply edits.

Note that I can rename struct field.

Expected Behavior

Enum field itself and all the usage of the field are renamed.

Relevant log output

No errors were shown in the log:

info : ( main ): Starting ZLS 0.13.0 @ '/usr/bin/zls'
info : (server): Client is 'Visual Studio Code-1.93.1'
info : (server): No config file zls.json found. This is not an error.
warning: (config): failed to open entry in PATH '/usr/bin/ccache/zig': error.NotDir
info : (server): Set config option 'builtin_path' to '/home/user/.cache/zls/builtin.zig'
info : (server): Set config option 'zig_lib_path' to '/home/user/.zvm/0.13.0/lib'
info : (server): Set config option 'zig_exe_path' to '/home/user/.zvm/bin/zig'
info : (server): Set config option 'build_runner_path' to '/home/user/.cache/zls/build_runner/21872970afd69e48a0847077e5196711/build_runner.zig'
info : (server): Set config option 'global_cache_path' to '/home/user/.cache/zls'
info : (server): Set config option 'enable_build_on_save' to 'true'
info : (server): Set config option 'enable_autofix' to 'true'
info : (server): Set config option 'semantic_tokens' to 'partial'
info : (server): Set config option 'warn_style' to 'true'
info : (server): Set config option 'highlight_global_var_declarations' to 'true'
@smallkirby smallkirby added the bug Something isn't working label Oct 1, 2024
@srijan-paul
Copy link
Contributor

srijan-paul commented Oct 1, 2024

I just found out that this works if you rename zero to zeroooo, but fails on zer0. Looking into it.

@smallkirby
Copy link
Author

That's a strange behavior...

I attach a debug log for your information, though it seems to have no useful information: zls-log.txt

@srijan-paul
Copy link
Contributor

srijan-paul commented Oct 1, 2024

Yeah, there'd be more logs in a debug build of zls.
I made a fix in #2043, let's wait to hear from the maintainer(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants