summaryrefslogtreecommitdiff
path: root/src/repl-jline
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Repl prints '\n' as newline, not "^J""Adriaan Moors2017-01-091-10/+2
| | | | | | This reverts commit d571fa07 (#5450). Superseded by upgrade to jline2 2.14.3 (jline/jline2@01969b5)
* Merge pull request #5450 from adriaanm/dev240Seth Tisue2016-10-201-2/+10
|\ | | | | Repl prints '\n' as newline, not "^J"
| * Repl prints '\n' as newline, not "^J"Adriaan Moors2016-10-081-2/+10
| | | | | | | | | | Work around a weird bug in JLine. Fix https://github.com/scala/scala-dev/issues/240
* | Merge 2.11.x into 2.12.x, including #5239, #5240Adriaan Moors2016-10-181-2/+5
|\ \ | |/ |/|
| * SI-9336 Enable paste detect in jlineSom Snytt2016-06-211-2/+5
| | | | | | | | | | When the next char is available immediately after a tab, the tab is taken raw instead of invoking completion.
* | SI-9762 Remove workaround after upstream fix in jlineJason Zaugg2016-04-271-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | Now that we use a release of JLine that includes the fix for: https://github.com/jline/jline2/issues/208 We no longer need to the workaround introduced in 7719a3c. Screencast of the still-fixed behaviour: http://recordit.co/5pzh9OhlQv.gif
* | SI-9762 Update to JLine 2.14.1Jason Zaugg2016-04-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivated by the improvements to multi-byte character handling. Screencast showing the reported bug is fixed: http://g.recordit.co/ie1Z367NUl.gif Here's the changelog since JLine 2.12.1: https://github.com/jline/jline2/compare/jline-2.12.1...jline-2.14.1 I needed to disable a new, on-by-default feature in JLine so that it didn't add a " " after completing the token `equals` in `foo.equa<TAB>`.
* | Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* | Remove the old REPL tab completion implementationJason Zaugg2015-09-231-8/+3
|/ | | | | We kept it around behind an option in 2.11.x, but we can jettison it in 2.12.x.
* Workaround JLine bug for mid-line tab completionJason Zaugg2015-09-111-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` scala> {" ".char<TAB>} charAt chars scala> {" ".char<CURSOR>}} ``` I noticed that pressing <SPACE>-<BACKSPACE> re-rendered the line correctly, so I've added this workaround to our customization of the JLine console reader. After: ``` scala> {" ".char<TAB>} charAt chars scala> {" ".char<CURSOR>} ``` We can delete this workaround when JLine 2.13.1 is released, but I haven't heard back about when this might happen.
* Use the presentation compiler to drive REPL tab completionJason Zaugg2015-09-022-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old implementation is still avaiable under a flag, but we'll remove it in due course. Design goal: - Push as much code in src/interactive as possible to enable reuse outside of the REPL - Don't entangle the REPL completion with JLine. The enclosed test case drives the REPL and autocompletion programatically. - Don't hard code UI choices, like how to render symbols or how to filter candidates. When completion is requested, we wrap the entered code into the same "interpreter wrapper" synthetic code as is done for regular execution. We then start a throwaway instance of the presentation compiler, which takes this as its one and only source file, and has a classpath formed from the REPL's classpath and the REPL's output directory (by default, this is in memory). We can then typecheck the tree, and find the position in the synthetic source corresponding to the cursor location. This is enough to use the new completion APIs in the presentation compiler to prepare a list of candidates. We go to extra lengths to allow completion of partially typed identifiers that appear to be keywords, e.g `global.def` should offer `definitions`. Two secret handshakes are included; move the the end of the line, type `// print<TAB>` and you'll see the post-typer tree. `// typeAt 4 6<TAB>` shows the type of the range position within the buffer. The enclosed unit test exercises most of the new functionality.
* Fix 25 typos (s)Janek Bogucki2015-07-061-1/+1
|
* SI-9206: REPL custom history fileIgor Racic2015-06-231-6/+6
| | | | Specify it with -Dscala.shell.histfile=/path/to/file.
* SI-9339 Support classpaths with no single compatible jlineAdriaan Moors2015-06-184-0/+338
As usual, the repl will use whatever jline 2 jar on the classpath, if there is one. Failing that, there's a fallback and an override. If instantiating the standard `jline.InteractiveReader` fails, we fall back to an embedded, shaded, version of jline, provided by `jline_embedded.InteractiveReader`. (Assume `import scala.tools.nsc.interpreter._` for this message.) The instantiation of `InteractiveReader` eagerly exercises jline, so that a linkage error will result if jline is missing or if the provided one is not binary compatible. The property `scala.repl.reader` overrides this behavior, if set to the FQN of a class that looks like `YourInteractiveReader` below. ``` class YourInteractiveReader(completer: () => Completion) extends InteractiveReader ``` The repl logs which classes it tried to instantiate under `-Ydebug`. # Changes to source & build The core of the repl (`src/repl`) no longer depends on jline. The jline interface is now in `src/repl-jline`. The embedded jline + our interface to it are generated by the `quick.repl` target. The build now also enforces that only `src/repl-jline` depends on jline. The sources in `src/repl` are now sure to be independent of it, though they do use reflection to instantiate a suitable subclass of `InteractiveReader`, as explained above. The `quick.repl` target builds the sources in `src/repl` and `src/repl-jline`, producing a jar for the `repl-jline` classes, which is then transformed using jarjar to obtain a shaded copy of the `scala.tools.nsc.interpreter.jline` package. Jarjar is used to combine the `jline` jar and the `repl-jline` into a new jar, rewriting package names as follows: - `org.fusesource` -> `scala.tools.fusesource_embedded` - `jline` -> `scala.tools.jline_embedded` - `scala.tools.nsc.interpreter.jline` -> `scala.tools.nsc.interpreter.jline_embedded` Classes not reachable from `scala.tools.**` are pruned, as well as empty dirs. The classes in the `repl-jline` jar as well as those in the rewritten one are copied to the repl's output directory. PS: The sbt build is not updated, sorry. PPS: A more recent fork of jarjar: https://github.com/shevek/jarjar.