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

Improvements to code assist in the REPL #110

Closed
wants to merge 449 commits into from

Conversation

retronym
Copy link
Owner

@retronym retronym commented Jan 27, 2021

Re-enable acronym-style completion, e.g. getClass.gdmoffersgetDeclaredMethod[s]`.

Under JLine completion, move all filtering up in the UI layer.
Reimplement scala#9510 (dealing with overloads that contain some
deprecated alternatives) in the UI layer

Fix completion of keyword-starting-idents (e.g. this.for<TAB> offers
formatted.

Register a widget on CTRL-SHIFT-T that prints the type of the
expression at the cursor. A second invokation prints the
desugared AST.

Enable levenstien based typo matching, but disable it for short strings
which IMO tends to offer confusing results.

Enable levenstien based typo matching:

scala> scala.tools.nsc.util.EditDistance.levenshtien<TAB>

scala> scala.tools.nsc.util.EditDistance.levenshtein

@retronym retronym force-pushed the ticket/12267-completion-matcher branch 2 times, most recently from 40e3c01 to 21168b4 Compare February 3, 2021 01:01
@retronym retronym changed the title WIP enable JLine 3.19 camel completion Improved REPL code completion in 2.13 Feb 3, 2021
@retronym retronym force-pushed the ticket/12267-completion-matcher branch 2 times, most recently from 62aedfe to beec5db Compare February 3, 2021 06:49
SethTisue and others added 24 commits March 10, 2021 09:51
Allow only protected when overriding Java methods(Correct the test)
REPL: improve tab-completion of `:`-prefixed commands (fixes scala/bug#12264)
Document sign extension in conversion to int for
purposes of enrichment.

Similarly for toOctalString and toBinaryString.
add testing for status quo of Byte and Short toHexString
allow $ escaping double quotes in interpolations under -Xsource:3
Changing `"Hello, \"World\""` to `s"Hello, \"$who\""` no longer breaks.

Before this change, `\"` terminated single-quoted interpolated string
literals, now the string remains open. The scanner doesn't interpret
the escape sequence, string interpolators can do so (`s` and `f` do).

Breaking changes:
  - `raw"c:\"` no longer compiles, it's now an unclosed string
  - `raw"c:\" // uh"` used to evaluate to `"""c:\"""`, now it's
    `"""c:\" // uh"""`
Also, unicode escapes are no longer interpreted in interpolated strings.
Interpolators can still interpret them, but that's not in the spec.
(now that it's possible to do so, after scala#9463)

In this case of e.g. `implicitNotFound`, this makes it clearer that
the custom error message must be a literal value.

Fixes scala#10424

Co-authored-by: Seth Tisue <seth@tisue.net>
The issue here was that in order to replace a
Scala 3 macro with a matching Scala 2 macro we have
to wait until we have seen all definitions in the
scope - before this PR, only Scala 3 macros were
considered for eviction, now all inline methods are.
Require less stack compiling 150 field case class (with a balanced AND)
@retronym
Copy link
Owner Author

Rebased. Updated to the new release of JLine which I've been waiting for.

TODO:

[info] Test scala.tools.nsc.interpreter.CompletionTest.defStringConstructor started
[error] Test scala.tools.nsc.interpreter.CompletionTest.defStringConstructor failed: org.junit.ComparisonFailure: expected:<[ def <init>(i: Int): Shazam]> but was:<[]>, took 0.448 sec
[error]     at scala.tools.nsc.interpreter.CompletionTest.checkExact(CompletionTest.scala:356)
[error]     at scala.tools.nsc.interpreter.CompletionTest.defStringConstructor(CompletionTest.scala:176)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:566)
[error]     ...
[info] Test scala.tools.nsc.interpreter.CompletionTest.constructor started
[info] Test scala.tools.nsc.interpreter.CompletionTest.completionsReplClassBased started
[error] Test scala.tools.nsc.interpreter.CompletionTest.completionsReplClassBased failed: org.junit.ComparisonFailure: expected:<[a_b_c]> but was:<[]>, took 0.884 sec
[error]     at scala.tools.nsc.interpreter.CompletionTest.checkExact(CompletionTest.scala:356)
[error]     at scala.tools.nsc.interpreter.CompletionTest.testCompletions(CompletionTest.scala:97)
[error]     at scala.tools.nsc.interpreter.CompletionTest.completionsReplClassBased(CompletionTest.scala:85)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:566)
[error]     ...

@retronym retronym changed the title Improved REPL code completion in 2.13 Improvements to code assist in the REPL May 20, 2021
som-snytt and others added 20 commits May 20, 2021 11:05
Handle Scala 3 star in import braces
Adapted multiarg infix is just a tuple
No protected accessor when accessing through self type
Check that varargs is applied only to methods
Regression test for varargs and seq override
Substitute both type and value parameter symbols in return type
Fix specialization of methods with dependent return types
Fix `ArrayOps` bugs (by avoiding using `ArraySeq#array`, which does not guarantee element type)
@retronym retronym force-pushed the ticket/12267-completion-matcher branch 3 times, most recently from d2386d1 to 4e1a4d1 Compare June 5, 2021 04:28
Re-enable acronmyn-style completion, e.g. getClass.gdm`
offers `getDeclaredMethod[s]`.

Disable the typo-matcher in JLine which tends to offer confusing

Fix completion of keywored-starting-idents (e.g. `this.for<TAB>` offers
`formatted`.

Register a widget on CTRL-SHIFT-T that prints the type of the
expression at the cursor. A second invokation prints the
desugared AST.

REPL completion - Enable levenstien based typo matching

```
scala> scala.tools.nsc.util.EditDistance.levenshtien<TAB>

scala> scala.tools.nsc.util.EditDistance.levenshtein<TAB>
```
@retronym retronym force-pushed the ticket/12267-completion-matcher branch from 4e1a4d1 to 85e7a41 Compare June 5, 2021 04:28
@retronym retronym closed this Jun 5, 2021
@retronym
Copy link
Owner Author

retronym commented Jun 7, 2021

Upstream PR: scala#9656

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