Skip to content

REPL tab completion includes spurious Any members #12514

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

Closed
som-snytt opened this issue May 18, 2021 · 3 comments · Fixed by #14649
Closed

REPL tab completion includes spurious Any members #12514

som-snytt opened this issue May 18, 2021 · 3 comments · Fixed by #14649
Assignees
Labels
Milestone

Comments

@som-snytt
Copy link
Contributor

Compiler version

➜  dotty git:(master) ./bin/scala -version
Scala compiler version 3.0.1-RC1-bin-SNAPSHOT-git-62f202b -- Copyright 2002-2021, LAMP/EPFL

Minimized code

scala> import scala.util.chaining.`s
scalaUtilChainingOps   synchronized

and then

scala> import scala.util.chaining.`sc
asInstanceOf           scalaUtilChainingOps
isInstanceOf           synchronized

and completion after sca

scala> import scala.util.chaining.`scasInstanceOf

I guess it's because package object?

scala> scala.util.chaining.asInstanceOf[Any]
val res1: Any = scala.util.package$chaining$@563843f1

Output

// as shown

Expectation

Tab completion shows actual members of thing being completed.

@griggt
Copy link
Contributor

griggt commented May 24, 2021

I'm unable to reproduce this:

$ ./bin/scala -version
Scala compiler version 3.0.1-RC1-bin-SNAPSHOT-git-62f202b -- Copyright 2002-2021, LAMP/EPFL

$ ./bin/scala
scala> import scala.util.chaining.`sc
scalaUtilChainingOps

(I presume the backtick is an indication of where the tab key was pressed)

@som-snytt
Copy link
Contributor Author

som-snytt commented May 24, 2021

Hmm. It's the same with 3.0.0 release or local project.

➜  ~ ~/projects/dotty/bin/scala
scala> 42
val res0: Int = 42

scala> import scala.util.chaining.s
scalaUtilChainingOps   synchronized

The backtick may have been because I expected a backticked identifier for the implicit.

Maybe backtick has special jline meaning?

scala> import scala.util.chaining.`sc
asInstanceOf           isInstanceOf           scalaUtilChainingOps   synchronized

@griggt
Copy link
Contributor

griggt commented May 24, 2021

Aha, so the backtick was part of the input! I tried that originally but there were no completions...or as it turns out, I am too impatient, as the completions when the backtick is included are very slow to appear here.

I can reproduce now, when including the backtick as typed input.

@anatoliykmetyuk anatoliykmetyuk added exp:intermediate Spree Suitable for a future Spree labels Jul 20, 2021
ckipp01 added a commit to ckipp01/dotty that referenced this issue Mar 9, 2022
This will ensure that when you try to backtick an import whether it's
needed or not that you correctly capture the prefix and offer a
backticked completion. For example:

```scala
import scala.util.chaining.`s<TAB>
```

Results in an `Ident(<error>)` which we now check to see if a backtick
is causing it and correctly offer the completion.

Fixes scala#12514
ckipp01 added a commit to ckipp01/dotty that referenced this issue Mar 9, 2022
This will ensure that when you try to backtick an import whether it's
needed or not that you correctly capture the prefix and offer a
backticked completion. For example:

```scala
import scala.util.chaining.`s<TAB>
```

Results in an `Ident(<error>)` which we now check to see if a backtick
is causing it and correctly offer the completion.

Fixes scala#12514
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants