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

completion of back-ticked members does not give backticks in REPL #14006

Closed
bjornregnell opened this issue Nov 26, 2021 · 3 comments · Fixed by #14594
Closed

completion of back-ticked members does not give backticks in REPL #14006

bjornregnell opened this issue Nov 26, 2021 · 3 comments · Fixed by #14594
Labels
area:repl itype:bug Spree Suitable for a future Spree
Milestone

Comments

@bjornregnell
Copy link
Contributor

bjornregnell commented Nov 26, 2021

Compiler version

3.1.0

Minimized code and output

Welcome to Scala 3.1.0 (11.0.11, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                
scala> enum BT { case `back-tick thing` }
// defined class BT
                                                                                
scala> BT.back-tick thing   //completed after pressing TAB on BT.back<TAB>
-- Error:
1 |BT.back-tick thing
  |^^^^^^^^^^^^
  |postfix operator `thing` needs to be enabled
  |by making the implicit value scala.language.postfixOps visible.
  |----
  |This can be achieved by adding the import clause 'import scala.language.postfixOps'
  |or by setting the compiler option -language:postfixOps.
  |See the Scaladoc for value scala.language.postfixOps for a discussion
  |why the feature needs to be explicitly enabled.

Expectation

The completion of back-ticked names should be wrapped into back-ticks so that the code works. A beginner might not know the rules of an identifier and a back-ticked member not following the rules is silently showing up in the list of completions. This may cause confusion.

It would also be nice if completion worked also after typing a back-tick.

scala> BT.`back-tick thing`  // completion does not work
val res0: BT = back-tick thing
@anatoliykmetyuk anatoliykmetyuk self-assigned this Dec 17, 2021
@anatoliykmetyuk anatoliykmetyuk added the Spree Suitable for a future Spree label Dec 17, 2021
@prolativ
Copy link
Contributor

prolativ commented Feb 2, 2022

This seems related to #13369

@ckipp01
Copy link
Member

ckipp01 commented Feb 26, 2022

Just to tie these together this also seems a duplicate of #4406.

I have a working POC locally

2022-02-26 14 19 20

But I'm still trying to fix some issues that were also noticed in #13369 when you are trying to start the completion with a backtick for example you end up getting your completion, but it then begins with two backticks, so I need to figure that out. Looks like this was also hit on in #11794.

All that to say, I'm working on this.

@som-snytt
Copy link
Contributor

They might have one of the old contributor's t-shirts lying around for you, that says:

You tick my back and I'll tick yours!

ckipp01 added a commit to ckipp01/dotty that referenced this issue Mar 1, 2022
This PR adds in the functionality to add in backticks when needed when
giving back completions and also correctly returning completions when
the user has already started typing a backtick.

Fixes: scala#4406, scala#14006
ckipp01 added a commit to ckipp01/dotty that referenced this issue Mar 1, 2022
This PR adds in the functionality to add in backticks when needed when
giving back completions and also correctly returning completions when
the user has already started typing a backtick.

Fixes: scala#4406, scala#14006
@ckipp01 ckipp01 linked a pull request Mar 1, 2022 that will close this issue
@anatoliykmetyuk anatoliykmetyuk removed their assignment Mar 2, 2022
@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
area:repl itype:bug Spree Suitable for a future Spree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants