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

better bitset completion #275

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

laytan
Copy link
Contributor

@laytan laytan commented Nov 28, 2023

Adds more completion support for bitsets.

  • "magic" completion when you type an expression that resolves to a bitset type and you use . it shows all possibilities in the bitset and when completion is confirmed removes the expression, leaving the .Variant. eg: variable. comes up with completions variable.Foo, variable.Bar, and confirming will remove the variable, leaving .Foo
  • add bitsets to the value decl completion, a : My_Bitset = { .* } will show the bitset variants after typing the .
  • add bitset variant completion when calling a procedure, eg: hello({ . }) shows the variants after typing the .

For that last point I had to remove an early return which would return if there was a comp literal in the context. This royally screwed the diff though because I had to indent the whole block by one (because of surrounding it with an if). Nothing in that hunk has changed though, just turned the early return into a normal if statement.

@@ -790,114 +844,112 @@ get_implicit_completion :: proc(

//infer bitset and enums based on the identifier comp_lit, i.e. a := My_Struct { my_ident = . }
if position_context.comp_lit != nil {
if position_context.parent_comp_lit.type == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This whole hunk/part of the diff is just turning this early return if into a regular if (in order to get to the part where call expressions are completed later). All this is just an indentation change.

@DanielGavin DanielGavin merged commit f0744a6 into DanielGavin:master Nov 28, 2023
6 checks passed
@DanielGavin
Copy link
Owner

Thanks for the PR.

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