File tree Expand file tree Collapse file tree 2 files changed +123
-1
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/completion Expand file tree Collapse file tree 2 files changed +123
-1
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,9 @@ class CompletionProvider(
218218 // related issue https://github.com/lampepfl/scala3/issues/11941
219219 lazy val kind : CompletionItemKind = underlyingCompletion.completionItemKind
220220 val description = underlyingCompletion.description(printer)
221- val label = underlyingCompletion.labelWithDescription(printer)
221+ val label =
222+ if config.isDetailIncludedInLabel then completion.labelWithDescription(printer)
223+ else completion.label
222224 val ident = underlyingCompletion.insertText.getOrElse(underlyingCompletion.label)
223225
224226 lazy val isInStringInterpolation =
Original file line number Diff line number Diff line change 1+ package dotty .tools .pc .tests .completion
2+
3+ import dotty .tools .pc .base .BaseCompletionSuite
4+
5+ import scala .meta .internal .pc .PresentationCompilerConfigImpl
6+ import scala .meta .pc .PresentationCompilerConfig
7+
8+ import org .junit .Test
9+
10+ class CompletionWithoutDetailsSuite extends BaseCompletionSuite :
11+
12+ override def config : PresentationCompilerConfig =
13+ PresentationCompilerConfigImpl ().copy(
14+ isDetailIncludedInLabel = false
15+ )
16+
17+ @ Test def `scope` =
18+ check(
19+ """
20+ |object A {
21+ | Lis@@
22+ |}""" .stripMargin,
23+ """ |List
24+ |List
25+ |List
26+ |List
27+ |ListUI
28+ |""" .stripMargin,
29+ includeDetail = false ,
30+ topLines = Some (5 )
31+ )
32+
33+ @ Test def `scope-detail` =
34+ check(
35+ """
36+ |object A {
37+ | Lis@@
38+ |}""" .stripMargin,
39+ """ |List[A](elems: A*): List[A]
40+ |List scala.collection.immutable
41+ |List java.awt
42+ |List java.util
43+ |ListUI javax.swing.plaf
44+ |""" .stripMargin,
45+ includeDetail = true ,
46+ topLines = Some (5 )
47+ )
48+
49+ @ Test def member =
50+ check(
51+ """
52+ |object A {
53+ | List.emp@@
54+ |}""" .stripMargin,
55+ """
56+ |empty
57+ |""" .stripMargin,
58+ includeDetail = false
59+ )
60+
61+ @ Test def extension =
62+ check(
63+ """
64+ |object A {
65+ | "".stripSu@@
66+ |}""" .stripMargin,
67+ """ |stripSuffix
68+ |""" .stripMargin,
69+ includeDetail = false
70+ )
71+
72+ @ Test def tparam =
73+ check(
74+ """
75+ |class Foo[A] {
76+ | def identity[B >: A](a: B): B = a
77+ |}
78+ |object Foo {
79+ | new Foo[Int].ident@@
80+ |}""" .stripMargin,
81+ """ |identity
82+ |""" .stripMargin,
83+ includeDetail = false
84+ )
85+
86+ @ Test def tparam1 =
87+ check(
88+ """
89+ |class Foo[A] {
90+ | def identity(a: A): A = a
91+ |}
92+ |object Foo {
93+ | new Foo[Int].ident@@
94+ |}""" .stripMargin,
95+ """ |identity
96+ |""" .stripMargin,
97+ includeDetail = false
98+ )
99+
100+ @ Test def tparam2 =
101+ check(
102+ """
103+ |object A {
104+ | Map.empty[Int, String].getOrEl@@
105+ |}
106+ |""" .stripMargin,
107+ """ |getOrElse
108+ |""" .stripMargin,
109+ includeDetail = false
110+ )
111+
112+ @ Test def pkg =
113+ check(
114+ """
115+ |import scala.collection.conc@@
116+ |""" .stripMargin,
117+ """ |concurrent
118+ |""" .stripMargin,
119+ includeDetail = false
120+ )
You can’t perform that action at this time.
0 commit comments