Skip to content

Commit 637b1d3

Browse files
committed
deal with unsafe nulls and fix sorting
1 parent 3b3b8a7 commit 637b1d3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala

+1
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ class Completions(
920920
v match
921921
case _: CompletionValue.SingletonValue => 0
922922
case _: CompletionValue.Compiler => 1
923+
case CompletionValue.ExtraMethod(_, _: CompletionValue.Compiler) => 1
923924
case _: CompletionValue.CaseKeyword => 2
924925
case _: CompletionValue.NamedArg => 3
925926
case _: CompletionValue.Keyword => 4

presentation-compiler/src/main/dotty/tools/pc/completions/SingletonCompletions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object SingletonCompletions:
3232
case (i @ Ident(name)) :: _ => List(name.toString() -> i.span)
3333
case (l @ Literal(const)) :: _ => List(const.show -> l.span)
3434
case _ => Nil
35-
query = name.replace(Cursor.value, "")
35+
query = name.replace(Cursor.value, "").nn
3636
tpe = tpe0 match
3737
// for Tuple 2 we want to suggest first arg completion
3838
case AppliedType(t: TypeRef, args) if t.classSymbol == Symbols.defn.Tuple2 && args.nonEmpty =>

presentation-compiler/test/dotty/tools/pc/tests/PcReferencesSuite.scala

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package dotty.tools.pc.tests
2+
3+
import scala.language.unsafeNulls
4+
25
import dotty.tools.pc.base.BasePCSuite
36
import dotty.tools.pc.utils.RangeReplace
4-
import scala.meta.internal.pc.PcReferencesRequest
5-
import scala.meta.internal.metals.CompilerVirtualFileParams
7+
68
import java.net.URI
7-
import scala.meta.internal.metals.EmptyCancelToken
89
import org.eclipse.lsp4j.jsonrpc.messages.{Either => JEither}
910
import scala.meta.internal.jdk.CollectionConverters.*
11+
import scala.meta.internal.metals.CompilerVirtualFileParams
12+
import scala.meta.internal.metals.EmptyCancelToken
13+
import scala.meta.internal.pc.PcReferencesRequest
1014

1115
import org.junit.Test
1216

0 commit comments

Comments
 (0)