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

Proposal: Only show missing fields in autocompletion on struct initialization #1849

Open
IntegratedQuantum opened this issue Apr 8, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@IntegratedQuantum
Copy link
Contributor

So right now I'm in the process of learning Vulkan and it has a ton of large configuration structs.
Now I would like to know what fields are missing so far and it would be nice if autocomplete would only show missing members.
Since it isn't allowed to initialize a field twice it doesn't even make sense to show already present fields.

Current:

Screenshot at 2024-04-08 21-10-34

Proposed:

Screenshot at 2024-04-08 21-10-35

@IntegratedQuantum IntegratedQuantum added the enhancement New feature or request label Apr 8, 2024
@Techatrix
Copy link
Member

The completion tests for struct initialization have some examples of this here.

@llogick
Copy link
Member

llogick commented Apr 11, 2024

Initial support in https://github.com/zigtools/zls/tree/nullptrdevs/c012,

Excludes fields/switch cases that precede the current source_index, ie

S{
   .a = 1,
   .b = 2,
   . // ^--- excluded from completions list
   .fields_here = 3,
   .are_shown = 4,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants