u8 local variable while debugging shows as string
Good day
Example code
const std = @import("std");
const expect = std.testing.expect;
test "while with continue expression" {
var sum: u8 = 0;
var i: u8 = 1;
while (i <= 10) : (i += 1) {
sum += i;
std.debug.print("{d}", .{i});
}
try expect(sum == 55);
}
on step 4 debug toolbar shows variables like this
i = '\x04'
sum = '\n'
when should be
i = 4
sum = 10
vscode-zig version
Identifier: ziglang.vscode-zig
Version: 0.6.3
Last Updated: 2025-01-17, 17:59:21
VScode version
Version: 1.96.4
Commit: cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
Date: 2025-01-16T00:16:19.038Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Linux x64 6.8.0-51-generic snap
Oh, I got it, u8 is used for char and extension thinks that nobody will use it as number? I just started learning zig
That would be the debuggers fault, I'm not sure how much the extension can do to control that and it probably shouldn't since a lot of times you want u8 to be printed as a character. When using lldb in the terminal you can use frame variable --format d sum to print sum as an integer but I'm not sure how that is done in the GUI.
It's obvious to me to make an assumption on how the variable was declared. with quotes or with a number. If it's too complicated, the issue can be closed.