You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enter a dot after my_slice[0..2] to trigger auto-completion.
Expected Behavior
Since the range is comptime-known, the type of my_slice[0..2] is *[2]f32, so typing . after my_slice[0..2] should open an autocomplete window that includes *.
Actual Behavior
Autocompleted suggestions are len and ptr, but not *.
This can be further validated by assigning the subslice to a variable and inspecting its type (by hovering over it), which is reported as []const f32.
constmy_subslice=my_slice[0..2];
The text was updated successfully, but these errors were encountered:
ZLS is not capable of resolving comptime-known values so it assumes that values are runtime-known. A special case that would detect a number literal being used as the start and end index when slicing could be added but anything more complex would be harder to implement.
Zig Version
0.11.0-dev.3322+82632aff2
Zig Language Server Version
0.11.0-dev.469+4f0762a
Steps to Reproduce
Using VS Code with the Zig extension, with the following code:
Enter a dot after
my_slice[0..2]
to trigger auto-completion.Expected Behavior
Since the range is comptime-known, the type of
my_slice[0..2]
is*[2]f32
, so typing.
aftermy_slice[0..2]
should open an autocomplete window that includes*
.Actual Behavior
Autocompleted suggestions are
len
andptr
, but not*
.This can be further validated by assigning the subslice to a variable and inspecting its type (by hovering over it), which is reported as
[]const f32
.The text was updated successfully, but these errors were encountered: