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

Struct init type hints #1778

Merged
merged 2 commits into from
Feb 19, 2024
Merged

Struct init type hints #1778

merged 2 commits into from
Feb 19, 2024

Conversation

llogick
Copy link
Member

@llogick llogick commented Feb 17, 2024

Partial #1531

Techatrix you get to name the config option :)

var buffer: [2]Ast.Node.Index = undefined;
const struct_init = tree.fullStructInit(&buffer, node) orelse return;
for (struct_init.ast.fields) |value_node| { // the node of `value` in `.name = value`
const name_token = tree.firstToken(value_node) - 2; // get --------------^^^^
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Disable inlay hints before aligning comments ...

@llogick llogick force-pushed the nullptrdevs/struct-init-type-hints branch from bc32bc6 to 2af33d3 Compare February 17, 2024 21:59
Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1a7a1fa) 76.77% compared to head (2e31eaa) 76.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1778      +/-   ##
==========================================
+ Coverage   76.77%   76.92%   +0.15%     
==========================================
  Files          35       35              
  Lines       10177    10190      +13     
==========================================
+ Hits         7813     7839      +26     
+ Misses       2364     2351      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Techatrix
Copy link
Member

Techatrix you get to name the config option :)

Coming up with a name for a config options is definitely not my strong suit. (╥﹏╥)
I would suggest something like "inlay_hints_show_anonymous_literal_field_type" or "inlay_hints_show_anon_literal_field_type"?

@llogick
Copy link
Member Author

llogick commented Feb 18, 2024

Are they anon literals though? + it works for regular S{.name<T> = ..} too

@llogick llogick force-pushed the nullptrdevs/struct-init-type-hints branch from 2af33d3 to 6d1713d Compare February 18, 2024 03:31
@Techatrix
Copy link
Member

Are they anon literals though? + it works for regular S{.name<T> = ..} too

oh right, then "inlay_hints_show_struct_literal_field_type"?

src/features/inlay_hints.zig Outdated Show resolved Hide resolved
src/features/inlay_hints.zig Outdated Show resolved Hide resolved
Co-authored-by: Techatrix <19954306+Techatrix@users.noreply.github.com>
@llogick llogick force-pushed the nullptrdevs/struct-init-type-hints branch from a181866 to 2e31eaa Compare February 19, 2024 01:20
@Techatrix Techatrix merged commit 97e7cde into master Feb 19, 2024
6 checks passed
@llogick llogick deleted the nullptrdevs/struct-init-type-hints branch February 19, 2024 02:16
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.

None yet

2 participants