zls icon indicating copy to clipboard operation
zls copied to clipboard

Semantic highlighting definition changes when the token is active

Open Jarred-Sumner opened this issue 2 years ago • 0 comments

Zig Version

0.11.0-dev.2571+31738de28

Zig Language Server Version

HEAD

Steps to Reproduce

  1. Reference a module
  2. Press .

Note that it always highlights JSC as "red" unless the text position is atJSC. . It has nothing to do with syntax errors.

Screen Recording 2023-04-17 at 9 41 56 PM

incase it helps, `JSC` is defined like

bun.zig:

pub const JSC = @import("./jsc.zig");

root.zig:

pub const bun = @import("./bun.zig");

bun_redirect.zig:

pub const bun = @import("root").bun;

build.zig:

    var bun = b.createModule(.{
        .source_file = FileSource.relative("src/bun_redirect.zig"),
    });

step.addModule("bun", bun);

So @import("bun") goes to @import("root").bun which goes to @import("./bun.zig"). The reason for this indirection was so that zls would be able to provide completions for platform-specific packages.

Expected Behavior

It shouldn't change the semantic token highlight color based on the text position

Actual Behavior

The semantic token changes when it shouldn't

Jarred-Sumner avatar Apr 18 '23 04:04 Jarred-Sumner