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

Tell lsp about variable bindings in match statements #1926

Merged
merged 4 commits into from
May 27, 2024
Merged

Conversation

jneem
Copy link
Member

@jneem jneem commented May 24, 2024

Fixes #1925

@jneem jneem requested a review from yannham May 24, 2024 16:20
@github-actions github-actions bot temporarily deployed to pull request May 24, 2024 16:22 Inactive
@@ -162,6 +162,34 @@ impl UsageLookup {

TraverseControl::ContinueWithScope(new_env)
}
Term::App(f, value) => {
Copy link
Member

Choose a reason for hiding this comment

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

Should we also do this even when the match isn't applied, like a function definition let foo = match { 'Bar payload => p[.] } to get payload completion on p (and maybe even record completion if we have type information on the argument of foo)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I've added that. I'm having some trouble coming up with a realistic test that uses type information to get completions. The problem is that if typechecking fails then completions just don't work at all right now. (I'll open an issue for this.) This means that something like

fun x => match { y => y.fo } : { foo: Number} -> Number

fails to type-check and therefore doesn't offer completions. I've made it "work" for now by writing

fun x => match { y => y.fo } : { foo: Number, fo: Number} -> Number

@github-actions github-actions bot temporarily deployed to pull request May 24, 2024 23:14 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 24, 2024 23:31 Inactive
@jneem jneem added this pull request to the merge queue May 27, 2024
Merged via the queue into master with commit b14aeea May 27, 2024
5 checks passed
@jneem jneem deleted the nls-match branch May 27, 2024 03:28
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.

Context-sensitive completion in match cases
2 participants