Skip to content

Scala 3 extension methods autocompletion shortcomings #1297

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

Open
mpollmeier opened this issue Oct 7, 2022 · 1 comment
Open

Scala 3 extension methods autocompletion shortcomings #1297

mpollmeier opened this issue Oct 7, 2022 · 1 comment

Comments

@mpollmeier
Copy link
Contributor

mpollmeier commented Oct 7, 2022

Autocompletion for Scala 3 extension methods currently has many shortcomings. Here's the status quo of what works and doesn't work with Scala 3.2.0.

Starting with the good: the following works, if you paste it as one block into amm:

class A
extension (a: A)
  def foobarbaz: Int = 42
val a = new A
// paste everything above as one block

a.foo<tab> // completes fine

Issue 1: if you paste the same in two blocks, autocompletion doesn't work any longer:

class A
// submit the above line first!

extension (a: A)
  def foobarbaz: Int = 42
val a = new A
a.foo<tab>  // doesn't autocomplete :(
a.foobarbaz // compiles fine though...

Update May 13, 2025: this is fixed (tested with Ammonite Repl 3.0.2 (Scala 3.6.3 Java 21.0.7)

Issue 2: the parser doesn't support curly braces

class A
extension (a: A) {
  def foobarbaz: Int = 42
}
val a = new A
a.foo<tab>  // doesn't autocomplete :(
a.foobarbaz // compiles fine though...

Issue 3: importing them from a different namespace doesn't work either:

class A
object AExt:
  extension (a: A)
    def foobarbaz: Int = 42
import AExt.foobarbaz
val a = new A

a.foo<tab>  // doesn't autocomplete :(
a.foobarbaz // compiles fine though...

All of the above work in the regular scala 3.2.0 repl.

@mpollmeier
Copy link
Contributor Author

Issue 1 is fixed (Ammonite Repl 3.0.2 (Scala 3.6.3 Java 21.0.7))
The other two remain though.

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

No branches or pull requests

1 participant