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

JLine 3: Support camel-cased, acronym-style completion as previously #12267

Closed
SethTisue opened this issue Mar 6, 2020 · 11 comments
Closed

JLine 3: Support camel-cased, acronym-style completion as previously #12267

SethTisue opened this issue Mar 6, 2020 · 11 comments
Assignees
Milestone

Comments

@SethTisue
Copy link
Member

for example, previously System.rFOE would complete to System.runFinalizersOnExit, but it doesn't anymore

@SethTisue SethTisue changed the title JLine 3: Support camel-cased, anagram-style completion as previously JLine 3: Support camel-cased, acronym-style completion as previously Mar 7, 2020
@SethTisue
Copy link
Member Author

@retronym at scala/scala#8036 (comment) :

AFAICT JLine is filtering candidates on our behalf. without an obvious extension point to add our own strategy.

@lrytz
Copy link
Member

lrytz commented Mar 9, 2020

It seems camelCase completers would be a sensible feature for JLine upstream? from jline/jline3#147

completers should return the full list of candidates, while matchers are responsible for the filtering [...]
The problem is that the matchers are not extensible
Would you mind working on a PR to make matchers extensible?

Then

I will [...] work on a PR

Not sure if this ever happened

@retronym
Copy link
Member

retronym commented Mar 9, 2020

@retronym
Copy link
Member

@SethTisue Here's a sketch of how I think JLine could be customized: https://github.com/retronym/jline3/pull/1/files

@SethTisue
Copy link
Member Author

removed from CompletionTest.scala for now:

  @Test
  def camelCompletions(): Unit = {
    val completer = setup()
    checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; tCSO")("theCatSatOnTheMat")
    checkExact(completer, "object O { def getBlerganator = 1 }; import O._; blerga")("getBlerganator")
    checkExact(completer, "object O { def xxxxYyyyyZzzz = 1; def xxxxYyZeee = 1 }; import O._; xYZ")("", "xxxxYyyyyZzzz", "xxxxYyZeee")
    checkExact(completer, "object O { def xxxxYyyyyZzzz = 1; def xxxxYyyyyZeee = 1 }; import O._; xYZ")("xxxxYyyyyZzzz", "xxxxYyyyyZeee")
    checkExact(completer, "object O { class AbstractMetaFactoryFactory }; new O.AMFF")("AbstractMetaFactoryFactory")
    checkExact(completer, "object O { val DECIMAL_DIGIT_NUMBER = 0 }; import O._; L_")("DECIMAL_DIGIT_NUMBER")
    checkExact(completer, "object O { val _unusualIdiom = 0 }; import O._; _ui")("_unusualIdiom")
  }

  @Test
  def lenientCamelCompletions(): Unit = {
    val completer = setup()
    checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; tcso")("theCatSatOnTheMat")
    checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; sotm")("theCatSatOnTheMat")
    checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; caton")("theCatSatOnTheMat")
    checkExact(completer, "object O { def theCatSatOnTheMat = 1; def catOnYoutube = 2 }; import O._; caton")("", "theCatSatOnTheMat", "catOnYoutube")
    checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; TCSOTM")()
  }

  @Test
  def snakeCompletions(): Unit = {
    val completer = setup()
    checkExact(completer, "object O { final val THE_CAT_SAT_ON_THE_MAT = 1 }; import O._; TCSO")("THE_CAT_SAT_ON_THE_MAT")
    checkExact(completer, "object O { final val THE_CAT_SAT_ON_THE_MAT = 1 }; import O._; tcso")("THE_CAT_SAT_ON_THE_MAT")
    checkExact(completer, "object C { def isIdentifierIgnorable = ??? ; val DECIMAL_DIGIT_NUMBER = 0 }; import C._; iii")("isIdentifierIgnorable")
  }

  @Test
  def performanceOfLenientMatch(): Unit = {
    val completer = setup()
    val ident: String = "thisIsAReallyLongMethodNameWithManyManyManyManyChunks"
    checkExact(completer, s"($ident: Int) => tia")(ident)
  }

@SethTisue SethTisue transferred this issue from scala/scala-dev Dec 8, 2020
@SethTisue SethTisue added the repl label Dec 8, 2020
@SethTisue SethTisue added this to the Backlog milestone Dec 8, 2020
@retronym retronym self-assigned this Dec 15, 2020
@retronym
Copy link
Member

Assigning myself because this is a pet feature of mine that I'd like to have back. I might tinker with the upstream contribution to JLine. I'll post my status here if/when I actively start working on this, feel free to work-steal the back, Seth, if you want to work on it yourself.

@retronym
Copy link
Member

Started the upstream PR: jline/jline3#626

@retronym
Copy link
Member

retronym commented Jan 27, 2021

I have a WIP PR that integrates the new JLine. So far so good. There are a few points to tidy up before I submit.

@SethTisue
Copy link
Member Author

I went ahead and PRed the JLine upgrade separately: scala/scala#9467 , as I think we'll want it regardless and now's a good time to be testing it

@retronym
Copy link
Member

retronym commented Feb 3, 2021

I'm quite happy with the state of my work in retronym/scala#110. See the PR description for the fixes and new features. @som-snytt @SethTisue would you like to give it a spin and see if you can spot any bugs or UI improvement ideas?

@SethTisue SethTisue modified the milestones: Backlog, 2.13.7 Aug 2, 2021
@SethTisue
Copy link
Member Author

PR: scala/scala#9656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants