summaryrefslogtreecommitdiff
path: root/src/repl/scala/tools/nsc/interpreter/PresentationCompilerCompleter.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-1/+0
| | | | | | | | | | - 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".
* Merge commit 'bb3ded3' into merge-2.11-to-2.12-oct-5Lukas Rytz2015-10-051-1/+1
|\
| * Support completion in erroneous string interpolation.Jason Zaugg2015-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the code: ``` s"${fooo<CURSOR" ``` The parser treats `fooo` as a interpolator ID for the quote that we actually intend to end the interpolated string. Inserting a space (in addition to `__CURSOR__` that we already patch in to avoid parsing a partial identifier as a keyword), solves this problem.
* | Remove the old REPL tab completion implementationJason Zaugg2015-09-231-3/+2
|/ | | | | We kept it around behind an option in 2.11.x, but we can jettison it in 2.12.x.
* Remove used param and document positionDeltaJason Zaugg2015-09-211-2/+2
|
* Hide some completion candidates on the first TABJason Zaugg2015-09-091-4/+15
| | | | | | When `foo.<TAB>`, assume you don't want to see the inherited members from Any_ and universally applicable extension methods like `ensuring`. Hitting <TAB> a second time includes them in the results.
* Camel Case and JavaBean completionJason Zaugg2015-09-081-7/+16
| | | | | | | | | | | | | | | | | | | | | | | This is just too useful to leave on the cutting room floor. ``` scala> classOf[String].enclo<TAB> scala> classOf[String].getEnclosing getEnclosingClass getEnclosingConstructor getEnclosingMethod scala> classOf[String].simpl<TAB> scala> classOf[String].getSimpleName type X = global.TTWD<TAB> scala> type X = global.TypeTreeWithDeferredRefCheck ``` I revised the API of `matchingResults` as it was clunky to reuse the filtering on accessibility and term/type-ness while providing a custom name matcher.
* Sort completion proposalsJason Zaugg2015-09-031-1/+1
|
* Don't offer `asInstanceOf` et al as completions in a fresh REPLJason Zaugg2015-09-031-1/+3
| | | | | Trying harder to keep the synthetic interpretter wrapper classes behind the curtain
* Add the prefix the autocompletion results (Scope-, TypeMember)Jason Zaugg2015-09-031-8/+7
| | | | | This makes life easier for clients of these APIs, we use this to avoid passing this around in the wrapper result `TypeMembers`.
* Use the presentation compiler to drive REPL tab completionJason Zaugg2015-09-021-0/+118
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.