diff options
author | Martin Odersky <odersky@gmail.com> | 2009-07-31 16:27:28 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-07-31 16:27:28 +0000 |
commit | 1a4566278cdaed86891f7c675c3d52a52379f029 (patch) | |
tree | 0520278c6bd0955ad42bac643c1afb4f1996e294 /src/compiler/scala/tools/nsc/interactive/CompilerControl.scala | |
parent | 24471facbd9ece2a972e47dfe792b0fae3356c50 (diff) | |
download | scala-1a4566278cdaed86891f7c675c3d52a52379f029.tar.gz scala-1a4566278cdaed86891f7c675c3d52a52379f029.tar.bz2 scala-1a4566278cdaed86891f7c675c3d52a52379f029.zip |
hooks for scope completion; background presenta...
hooks for scope completion; background presentation compiler is no more
incremental. Refactorings in IDE support
Diffstat (limited to 'src/compiler/scala/tools/nsc/interactive/CompilerControl.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/CompilerControl.scala | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala index d46b5b4b89..942a6f5c86 100644 --- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala +++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala @@ -54,11 +54,17 @@ trait CompilerControl { self: Global => def locateTree(pos: Position): Tree = new Locator(pos) locateIn unitOf(pos).body - /** Locate smallest context that encloses position + /** Locates smallest context that encloses position as an optional value. */ def locateContext(pos: Position): Option[Context] = locateContext(unitOf(pos).contexts, pos) + /** Returns the smallest context that contains given `pos`, throws FatalError if none exists. + */ + def doLocateContext(pos: Position): Context = locateContext(pos) getOrElse { + throw new FatalError("no context found for "+pos) + } + /** Make sure a set of compilation units is loaded and parsed. * Return () to syncvar `result` on completion. */ @@ -76,10 +82,23 @@ trait CompilerControl { self: Global => override def toString = "typeat "+pos.source+" "+pos.show } - def askCompletion(pos: Position, result: Response[List[Member]]) = + /** Set sync var `result' to list of members that are visible + * as members of the tree enclosing `pos`, possibly reachable by an implicit. + * - if `selection` is false, as identifiers in the scope enclosing `pos` + */ + def askTypeCompletion(pos: Position, result: Response[List[Member]]) = + scheduler postWorkItem new WorkItem { + def apply() = self.getTypeCompletion(pos, result) + override def toString = "type completion "+pos.source+" "+pos.show + } + + /** Set sync var `result' to list of members that are visible + * as members of the scope enclosing `pos`. + */ + def askScopeCompletion(pos: Position, result: Response[List[Member]]) = scheduler postWorkItem new WorkItem { - def apply() = self.completion(pos, result) - override def toString = "completion "+pos.source+" "+pos.show + def apply() = self.getScopeCompletion(pos, result) + override def toString = "scope completion "+pos.source+" "+pos.show } /** Ask to do unit first on present and subsequent type checking passes */ |