File tree 2 files changed +21
-1
lines changed
src/dotty/tools/dotc/interactive 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ object Interactive {
329
329
330
330
def contextOfPath (path : List [Tree ])(implicit ctx : Context ): Context = path match {
331
331
case Nil | _ :: Nil =>
332
- ctx.run.runContext. fresh.setCompilationUnit(ctx.compilationUnit)
332
+ ctx.fresh.setCompilationUnit(ctx.compilationUnit)
333
333
case nested :: encl :: rest =>
334
334
import typer .Typer ._
335
335
val outer = contextOfPath(encl :: rest)
Original file line number Diff line number Diff line change @@ -60,4 +60,24 @@ class TabcompleteTests extends ReplTest {
60
60
val expected = List (" comp1" , " comp2" , " comp3" )
61
61
assertEquals(expected, tabComplete(" (new Foo).comp" ).sorted)
62
62
}
63
+
64
+ @ Test def completeFromPreviousState2 =
65
+ fromInitialState { implicit state =>
66
+ val src = " def hello = 1"
67
+ run(src)
68
+ }
69
+ .andThen { implicit state =>
70
+ val expected = List (" hello" )
71
+ assertEquals(expected, tabComplete(" hel" ))
72
+ }
73
+
74
+ @ Test def tabCompleteFromPreviousImport =
75
+ fromInitialState { implicit state =>
76
+ val src = " import java.io.FileDescriptor"
77
+ run(src)
78
+ }
79
+ .andThen { implicit state =>
80
+ val expected = List (" FileDescriptor" )
81
+ assertEquals(expected, tabComplete(" val foo: FileDesc" ))
82
+ }
63
83
}
You can’t perform that action at this time.
0 commit comments