Get a list of struct fields

When calling a function, I can use Cmd + P to get a list of all arguments the function requires. Is there something similar for struct fields? 

Thank you.

0
3 comments

Hi Bharat,

there is no ability to view available fields on Cmd+P at the moment, the closest you can get is to invoke Ctrl+Q on struct name or hover the mouse with Cmd pressed over struct name - both show struct fields. Viewing fields on Cmd+P seems to be more convenient, I've filed a feature request for that: https://youtrack.jetbrains.com/issue/GO-5983, please watch/vote for it.

0

Thanks for the tips. The second solution (hover the mouse with Cmd pressed over struct name) works for me. That is quite helpful. For some reason Ctrl+Q does not do anything.

I voted for the feature request. Thanks again.

0

BTW do you want to set value of all the fields? If so, then there is an intention inside a struct literal doing just that. There is also an intention which fills fields recursively.

0

Please sign in to leave a comment.