Skip to content

Commit fbe7265

Browse files
kasiaMarekWojciechMazur
authored andcommitted
deal with unsafe nulls and fix sorting
[Cherry-picked 637b1d3]
1 parent bb6b0c1 commit fbe7265

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ class Completions(
926926
v match
927927
case _: CompletionValue.SingletonValue => 0
928928
case _: CompletionValue.Compiler => 1
929+
case CompletionValue.ExtraMethod(_, _: CompletionValue.Compiler) => 1
929930
case _: CompletionValue.CaseKeyword => 2
930931
case _: CompletionValue.NamedArg => 3
931932
case _: CompletionValue.Keyword => 4

Diff for: 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 =>

Diff for: 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)