Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing inlay hints with arrays of unknown types #1886

Open
vadim-za opened this issue May 4, 2024 · 0 comments
Open

Confusing inlay hints with arrays of unknown types #1886

vadim-za opened this issue May 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vadim-za
Copy link

vadim-za commented May 4, 2024

Zig Version

0.12.0

Zig Language Server Version

0.12.0

Client / Code Editor / Extensions

VS Code 1.86.1 (Windows), extension: Zig Language v0.5.7

Steps to Reproduce and Observed Behavior

Enter the following code in the editor:

pub fn main() void {
    const v = SomeType{};
    const a = [2]SomeType{ .{}, .{} };
}

Observed inlay hints (underscores are used to mark the inlay hints in the code):

    const v = SomeType{};
    const a __: [2](unknown type)__ = [2]SomeType{ .{}, .{} };

Expected Behavior

  • The inlay hints for the v and a constants are inconsistent to each other. Expected either both inlay hints be present or both be absent (preferably absent, as suggested in Don't show inlay if variable was initialized with a type already #1526).
  • More importantly, the inlay hint for the a constant, if any, is expected to display [2]SomeType rather than [2](unknown type), as the type is directly available from the RHS of the = sign. Same holds for the inlay hint for v.

Apparently, the whole issue can become obsolete if #1526 is implemented, reporting just in case.

Relevant log output

No response

@vadim-za vadim-za added the bug Something isn't working label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant