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

Complete anon struct fields in fn calls (parser permitting) #1275

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

llogick
Copy link
Contributor

@llogick llogick commented Jun 28, 2023

ZLS_AnonStruct_large

Limitations:

  • Parser's (in)ability to deal with incomplete/having certain sequence of tokens blocks - namely . followed by a }
    For example the above wouldn't work if it were const exe = b.addExecutable(.{.}
  • comptimestuff
  • Fn param types that arent T or path.to.T

Extra:

In the "Crowd goes mild" category
ZLS_AnonStruct_cgoes
Given the current builtins that infer type, I expect it might become a common occurrence to provide the type on the left.

Bonus !
ZLS_AnonStruct_bonus
Lee mentioned it being a common case (aliases).

General tips and tricks for helping out the parser

  • If, after typing a ., Hover or Go To Def aren't available for a symbol, suggestions won't work either
  • Try removing the }, makes completion within the container itself work (Case2 in the above linked PR)
  • If this is the last statement in a fn and you're not getting completions, use this trick:
    const exe = b.addExecutable(.{.; // note the `;`
    const a ; // as long as the name is unique
}

@llogick llogick force-pushed the complete-anon-struct-fields branch from 74a0c4d to 382c9bd Compare June 28, 2023 23:31
@leecannon leecannon merged commit ad6a027 into zigtools:master Jun 29, 2023
@llogick llogick deleted the complete-anon-struct-fields branch June 29, 2023 16:42
acristoffers pushed a commit to acristoffers/zls that referenced this pull request Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants