Skip to content

Support dot completion inside case branches - #237

Merged
faiface merged 1 commit into
par-team:mainfrom
Toucan4Life:add_autocomplete_either_choice
Aug 7, 2026
Merged

Support dot completion inside case branches#237
faiface merged 1 commit into
par-team:mainfrom
Toucan4Life:add_autocomplete_either_choice

Conversation

@Toucan4Life

Copy link
Copy Markdown
Contributor

Add dot-autocomplete for case branch heads in Par completion.

either branch heads

Before, typing inside a branch head like this did not propose the valid branches:

type Stream = either {
  .end!,
  .chunk !,
}

def StreamValue : Stream = external
def Main : ! = StreamValue.case {
  .
}

Now it suggests:

  • chunk()
  • end!

choice branch heads

For begin case, branch-head completion now works here:

type Sequence = iterative choice {
  .close => !,
  .next => self,
}

def Main : Sequence = begin case {
  .
}

and suggests:

  • close
  • next

Recursive / named types

This also works when the branch set comes from a recursive or named type rather than from text already present in the current case block.

Example:

type Repeat = recursive either {
  .end!,
  .step self,
}

def RepeatValue : Repeat = external
def Main : ! = do {
RepeatValue.begin.case {
  .
}
} in !

Now it suggests:

  • end!
  • step()

Anything that might be missing?

My next target is to work on the description of the autocomplete, and when the todo keyword is implemented, I would like that when choosing a suggestion from the autocomplete automatically insert some code snippet. Like for the branch that this PR worked on, instead of inserting only .step(), it would insert .step() => todo.

I would also like to work on the hover tooltip; I would like that when you hover a function or a reserved keyword of par, it show an hover of the usage of that function/keyword, like in rust.

Or do you want me to work on another things for my next PR?

Also congrats on the paper :D

@Toucan4Life
Toucan4Life force-pushed the add_autocomplete_either_choice branch from 71d131d to 7a76f22 Compare July 31, 2026 20:11
@faiface

faiface commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Nice, this looks good, thank you @Toucan4Life, merging!

@faiface
faiface merged commit 7a31f2c into par-team:main Aug 7, 2026
3 checks passed
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