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

Add Size and Alignment on type/field hover #70

Open
Caleb-o opened this issue Sep 12, 2024 · 6 comments
Open

Add Size and Alignment on type/field hover #70

Caleb-o opened this issue Sep 12, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@Caleb-o
Copy link

Caleb-o commented Sep 12, 2024

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Both Golang and Rust show the size and alignment of types. Since C3 is a lower level language, it would be useful to have this information available on hover, instead of needing to use something like reflection.

Describe alternatives you've considered
Reflection could be used, but it is not as convenient

Additional context
Type:
image

Field (from Josh):
image

@pherrymason pherrymason added the enhancement New feature or request label Sep 12, 2024
@joshring
Copy link

Go's LSP Gopls may be a helpful reference, here's the code:
https://go-review.googlesource.com/c/tools/+/573076

@pherrymason
Copy link
Owner

Is there any reference on C3 about what size every type uses?

@Caleb-o
Copy link
Author

Caleb-o commented Sep 13, 2024

There is a list on basic types that shows the bit size of primitives

@Caleb-o
Copy link
Author

Caleb-o commented Sep 13, 2024

As a note, you also need to take alignment into account for padding in structs. Unions are just the size of their largest item. To verify that types are calculated properly, you can use sizeof from type properties to validate the size is correct.

@Caleb-o
Copy link
Author

Caleb-o commented Oct 4, 2024

@pherrymason how is this going? There was some progress posted in the tooling channel of discord, but haven't heard anything since. Did you get stuck or did life start doing life things and you've been busy?

@pherrymason
Copy link
Owner

Sorry, I've been more busy lately and could not advance with this

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