From b89874b7c0bb9ad8e2276b652580f3aaf3e5c621 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 9 Sep 2015 21:45:04 +1000 Subject: Fix REPL completion of symbolic identifiers Recover part of the identifier that preceded the cursor from the source, rather than from the name in the `Select` node, which might contains an encoded name that differs in length from the one in source. --- src/interactive/scala/tools/nsc/interactive/Global.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/interactive') diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala index d6be6331ce..cc4b845b2c 100644 --- a/src/interactive/scala/tools/nsc/interactive/Global.scala +++ b/src/interactive/scala/tools/nsc/interactive/Global.scala @@ -1223,9 +1223,8 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") def typeCompletions(tree: Tree, qual: Tree, nameStart: Int, name: Name): CompletionResult = { val qualPos = qual.pos val allTypeMembers = typeMembers(qualPos).toList.flatten - val positionDelta: Int = nameStart - pos.start - val subName = name.subName(0, -positionDelta) + val subName: Name = name.newName(new String(pos.source.content, nameStart, pos.start - nameStart)).encodedName CompletionResult.TypeMembers(positionDelta, qual, tree, allTypeMembers, subName) } focus1 match { -- cgit v1.2.3