Skip to content

Rename symbol renames the value instead of the constant binding #3184

@obaibula

Description

@obaibula

Zig Version

0.16.0

ZLS Version

0.16.0

Client / Code Editor / Extensions

nvim v0.11.6 with 'neovim/nvim-lspconfig'

Steps to Reproduce and Observed Behavior

  1. Create a file:
const std = @import("std");
const testName = std.debug.print;

pub fn main() void {
    testName("hello\n", .{});
}
  1. Rename testName into newTestName.
  2. The result is that the std.debug.print function is renamed instead of the testName constant, directly in the Zig standard library.
const std = @import("std");
const testName = std.debug.newTestName;

pub fn main() void {
    testName("hello\n", .{});
}

Expected Behavior

The testName constant should be renamed instead of the std.debug.print:

const std = @import("std");
const newTestName = std.debug.print;

pub fn main() void {
    newTestName("hello\n", .{});
}

Attach ZLS log output

zls.log
info  ( main ): Starting ZLS      0.16.0 @ 'zls'
info  ( main ): Log File:         /home/oleh/.cache/zls/zls.log (info)
info  (server): Client Info:      Neovim (0.11.6)
info  (server): Set config option 'builtin_path' to "/home/oleh/.cache/zls/builtin.zig"
info  (server): Set config option 'zig_lib_path' to "/opt/zig-bin-0.16.0/lib"
info  (server): Set config option 'zig_exe_path' to "/opt/zig-bin-0.16.0/zig"
info  (server): Set config option 'build_runner_path' to "/home/oleh/.cache/zls/build_runner/0536d83f23cda18cf0a02d9cd4e6dce4/build_runner.zig"
info  (server): Set config option 'global_cache_path' to "/home/oleh/.cache/zls"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions