Skip to content

Conversation

@jkciesluk
Copy link
Member

connected to #5339

@ckipp01
Copy link
Member

ckipp01 commented Jun 16, 2023

You're so fast @jkciesluk! 🚀

@jkciesluk jkciesluk force-pushed the case-keyword-comp branch from d83b03e to 4709e30 Compare June 16, 2023 11:48
@jkciesluk jkciesluk linked an issue Jun 23, 2023 that may be closed by this pull request
@jkciesluk jkciesluk requested a review from tgodzik June 23, 2023 13:09
|}""".stripMargin,
"""|case None => scala
|case Some(value) => scala
|case
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if people would find it useful, this is suggested as a last option, so going down is almost the same amount of button clicks as just writing case.

I would rather suggest this if we weren't able to suggest anything else.

How will this behave in the case that is in the linked issues?

Option(1).map{
  c@@
  case Some(a) =>
}

it would be awesome if None was suggested. Having just case would also be nice, but that would be a minimum I would expect to show up.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it already suggests None:
image

Are you thinking about suggesting only not covered cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should only show a single case if nothing else is shown to the user. Otherwise it's not that useful.

I think it already suggests None:

Do we have a test case for that? I thought this not working was the issue raised?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought this not working was the issue raised?

I believe the issue was raised because there was no case completions at all, but this happened because there was no extending classes, just objects with unapply, which we don't check (maybe we could, by looking through object in scope with unapply method and correct argument?).

Do we have a test case for that?

No, I will add it.

I think we should only show a single case if nothing else is shown to the user.
Sure, we can do that

@jkciesluk jkciesluk force-pushed the case-keyword-comp branch 2 times, most recently from f4479ad to 8632397 Compare June 27, 2023 07:52
val label = "case"
val suffix =
if (clientSupportsSnippets) " $0 =>"
else ""
Copy link
Member

Choose a reason for hiding this comment

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

I'd add the space after case anyway.

@jkciesluk jkciesluk force-pushed the case-keyword-comp branch 3 times, most recently from 3c82024 to ffdc195 Compare January 15, 2024 09:32
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM

@tgodzik tgodzik merged commit 0fef9a1 into scalameta:main Jan 25, 2024
@jkciesluk jkciesluk deleted the case-keyword-comp branch February 1, 2024 13:53
jkciesluk added a commit to jkciesluk/dotty that referenced this pull request Feb 1, 2024
rochala pushed a commit to scala/scala3 that referenced this pull request Feb 2, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 28, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 30, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 30, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 30, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 30, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 30, 2024
WojciechMazur pushed a commit to scala/scala3 that referenced this pull request Jun 30, 2024
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.

No case completion offered in specific situation

4 participants