Currently, the semantic token of fields in a mutable item (e.g. var variable, mutable pointer) is property, but as the field can be change, it should have a mutable modifier in its semantic token, same as var variables. Though the mutable modifier takes no effect for now, unless we implement https://codeberg.org/ziglang/vscode-zig/issues/492.
For example:
fn f() void {
var a: struct {
x: u32,
} = .{ .x = 1 };
const b = &a;
_ = a.x; // `x` here should be taggeg `mutable`
_ = b.*.x; // `x` here should be taggeg `mutable`
}
Moreover, methods that accepts self: *@This() can also tagged as mutable, to indicate that it may change the fields of self in the method body.
Currently, the semantic token of fields in a mutable item (e.g.
varvariable, mutable pointer) isproperty, but as the field can be change, it should have amutablemodifier in its semantic token, same asvarvariables. Though themutablemodifier takes no effect for now, unless we implement https://codeberg.org/ziglang/vscode-zig/issues/492.For example:
Moreover, methods that accepts
self: *@This()can also tagged asmutable, to indicate that it may change the fields of self in the method body.