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

[Scala 3] Incorrect named arguments completions #7188

Closed
tgodzik opened this issue Feb 3, 2025 · 10 comments
Closed

[Scala 3] Incorrect named arguments completions #7188

tgodzik opened this issue Feb 3, 2025 · 10 comments
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3 spree

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Feb 3, 2025

Describe the bug

"""|trait Foo {
| def bar[A](fst: A, snd: Int, thd: Int = 23)
|}
|object Main {
| def foo: Foo = ???
| foo.bar(123, @@)
|}
|""".stripMargin

Expected behavior

Completions should be for both params:

"""|snd = : Int
|thd = : Int
|""".stripMargin

Operating system

None

Editor/Extension

None

Version of Metals

v1.5.2

Extra context or search terms

https://github.com/scalameta/metals/pull/7182/files

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3 labels Feb 3, 2025
@mbovel
Copy link

mbovel commented Feb 20, 2025

I reproduced on my Mac with Metals 1.5.1. After running the "Trigger Suggest" command, I see:

Image

So I guess, this should also suggest "snd"?

@mbovel
Copy link

mbovel commented Feb 20, 2025

I get the same without the body of bar:

Image
Build definition is coming from scala-cli.
Build server currently being used is scala-cli v1.5.0. ([Reset](command:metals.reset-choice?%5B%22Build+server+selection%22%5D))

@bishabosha
Copy link
Contributor

bishabosha commented Feb 20, 2025

I also investigated and can reproduce with Scala 3.3.4 and 3.5.2, but it seems to be fixed in Scala 3.3.5/3.6.3

@mbovel
Copy link

mbovel commented Feb 20, 2025

I was running with Scala 3.5.0.

With 3.6.3, I see snd = as expected:

Image

@mbovel
Copy link

mbovel commented Feb 20, 2025

@tgodzik not sure what we should do here. Should we fix it for the case where the user run a version in 3.3.1..3.3.2? In later versions, this works as expected.

@bishabosha
Copy link
Contributor

bishabosha commented Feb 20, 2025

We probably wasted a bunch of time not realising that the plan is to continue supporting the older scala LTS versions in metals - and now looks like we can back port whatever was fixed in scala/scala3

@mbovel
Copy link

mbovel commented Feb 20, 2025

Guess: maybe this has been fixed by scala/scala3#18702 in the new presentation compiler.

So to support older version, should we backport the fix to https://github.com/scalameta/metals/blob/main/mtags/src/main/scala-3/scala/meta/internal/pc?

@mbovel
Copy link

mbovel commented Feb 20, 2025

For reference, here is how we ran the test:

$ sbt --client '++3.3.3! cross/testOnly tests.BaseCompletionSuite.CompletionArgSuite -- *default-args8*'

@tgodzik
Copy link
Contributor Author

tgodzik commented Feb 20, 2025

For future reference, we don't have to backport it to metals. It's fine to have it fixed in the newest presentation compiler only. Thanks for checking!

@tgodzik tgodzik closed this as completed Feb 20, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Metals Issue Board Feb 20, 2025
@tgodzik
Copy link
Contributor Author

tgodzik commented Feb 20, 2025

Also, sorry for not responding earlier 😓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3 spree
Projects
Development

No branches or pull requests

4 participants