Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Draft as I couldn't get it to work with Zed for some reason, right now only VSCode is working. Will investigate.(EDIT: Turns out this will require a PR to
c3-zed
to work with Zed. That means it isn't the LSP's fault, so the PR itself should be fine. However, I'll keep it as a draft as I'll need to rebase on #103 later. (Done!))Basically, this adds type information as well as other information to completions, making them more immediately helpful.
This was inspired by a similar feature in the Gleam language's LSP.
I chose to simply add a "Type" hint for struct, bitstruct and union as I felt like being more specific wouldn't be too helpful, but let me know if you'd prefer to have "Struct", "Bitstruct" and "Union" instead (I'd be ok with that as well, the former just felt a bit cleaner to me, but I don't mind it that much).
I also chose "Enumerator" for enum values, but I'm thinking of writing just "Enum value" as that's clearer.(Changed to "Enum Value")Also, I chose "Fault Constant" for fault constants and "Struct member 'name'" for anonymous substructs.
In addition,
def
s display "Type" when they're type aliases, or "Alias for ''" otherwise since we have little to no semantic information (as an exception, I also display "Alias for macro '@macroname'" when we know for sure it's a macro due to@
).Future work
Screenshots