@@ -84,7 +84,7 @@ object Interactive {
84
84
85
85
( sym == tree.symbol
86
86
|| sym.exists && sym == sourceSymbol(tree.symbol)
87
- || include != 0 && sym.name == tree.symbol.name && sym.owner != tree.symbol.owner
87
+ || include != 0 && sym.name == tree.symbol.name && sym.maybeOwner != tree.symbol.maybeOwner
88
88
&& ( (include & Include .overridden) != 0 && overrides(sym, tree.symbol)
89
89
|| (include & Include .overriding) != 0 && overrides(tree.symbol, sym)
90
90
)
@@ -99,6 +99,7 @@ object Interactive {
99
99
* @return offset and list of symbols for possible completions
100
100
*/
101
101
// deprecated
102
+ // FIXME: Remove this method
102
103
def completions (trees : List [SourceTree ], pos : SourcePosition )(implicit ctx : Context ): (Int , List [Symbol ]) = {
103
104
val path = pathTo(trees, pos)
104
105
val boundary = enclosingDefinitionInPath(path).symbol
@@ -148,14 +149,17 @@ object Interactive {
148
149
ref.name.isTermName,
149
150
ref.name.isTypeName)
150
151
case _ =>
151
- println(i " COMPUTE from ${path.headOption}" )
152
152
(0 , " " , false , false )
153
153
}
154
154
155
155
/** Include in completion sets only symbols that
156
- * - start with given name prefix
157
- * - do not contain '$' except in prefix where it is explicitly written by user
158
- * - have same term/type kind as name prefix given so far
156
+ * 1. start with given name prefix, and
157
+ * 2. do not contain '$' except in prefix where it is explicitly written by user, and
158
+ * 3. have same term/type kind as name prefix given so far
159
+ *
160
+ * The reason for (2) is that we do not want to present compiler-synthesized identifiers
161
+ * as completion results. However, if a user explicitly writes all '$' characters in an
162
+ * identifier, we should complete the rest.
159
163
*/
160
164
def include (sym : Symbol ) =
161
165
sym.name.startsWith(prefix) &&
@@ -197,7 +201,9 @@ object Interactive {
197
201
addMember(imp.site, name)
198
202
addMember(imp.site, name.toTypeName)
199
203
}
200
- for (renamed <- imp.reverseMapping.keys) addImport(renamed)
204
+ // FIXME: We need to also take renamed items into account for completions,
205
+ // That means we have to return list of a pairs (Name, Symbol) instead of a list
206
+ // of symbols from `completions`.!=
201
207
for (imported <- imp.originals if ! imp.excluded.contains(imported)) addImport(imported)
202
208
if (imp.isWildcardImport)
203
209
for (mbr <- accessibleMembers(imp.site) if ! imp.excluded.contains(mbr.name.toTermName))
@@ -209,8 +215,7 @@ object Interactive {
209
215
implicit val ctx = ictx
210
216
211
217
if (ctx.owner.isClass) {
212
- for (mbr <- accessibleMembers(ctx.owner.thisType))
213
- addMember(ctx.owner.thisType, mbr.name)
218
+ addAccessibleMembers(ctx.owner.thisType)
214
219
ctx.owner.asClass.classInfo.selfInfo match {
215
220
case selfSym : Symbol => add(selfSym)
216
221
case _ =>
@@ -391,7 +396,7 @@ object Interactive {
391
396
}
392
397
localCtx
393
398
case tree @ Template (constr, parents, self, _) =>
394
- if ((constr :: self :: parents).exists (nested `eq` _ )) ctx
399
+ if ((constr :: self :: parents).contains (nested)) ctx
395
400
else contextOfStat(tree.body, nested, tree.symbol, outer.inClassContext(self.symbol))
396
401
case _ =>
397
402
outer
0 commit comments