zls icon indicating copy to clipboard operation
zls copied to clipboard

function pointer constant is not highlighted as a function

Open btakita opened this issue 11 months ago • 1 comments

Zig Version

0.15.2 + 0.16.0 (master)

ZLS Version

0.15.2 + 0.16.0-dev.82+cbb62284 (modified to build with Zig 0.16 master...See https://github.com/zigtools/zls/pull/2546)

Client / Code Editor / Extensions

Idea using ZigBrains

Steps to Reproduce and Observed Behavior

In https://github.com/btakita/lazily-zig/blob/main/src/examples/auth/root.zig, I have:

const deinitAuthToken = deinitSlotValue(
    AuthToken,
    null,
);

Expected Behavior

Both deinitAuthToken and deinitSlotValue should be colored as a function.

See https://github.com/FalsePattern/ZigBrains/issues/172

Log Output

I was not able to find the logs using the custom build. The file path was not present in the 0.15.2 logs.

btakita avatar Jan 04 '26 20:01 btakita

Reduction:

const FnProto = *const fn () void;
const func: FnProto = undefined;

The func token is being highlighted as a variable instead of function. Changing the definition of FnProto to fn () void causes it to be highlighted like a function as expected.

techatrix avatar Feb 08 '26 13:02 techatrix