File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
src/main/dotty/tools/pc/completions
test/dotty/tools/pc/tests/completion Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -261,13 +261,17 @@ object CompletionValue:
261261 end NamedArg
262262
263263 case class Autofill (
264- value : String
264+ value : String ,
265+ _label : String ,
265266 ) extends CompletionValue :
267+ private inline val descriptionText = " Autofill with default values"
266268 override def completionItemKind (using Context ): CompletionItemKind =
267269 CompletionItemKind .Enum
268270 override def completionItemDataKind : Integer = CompletionSource .OverrideKind .ordinal
269271 override def insertText : Option [String ] = Some (value)
270- override def label : String = " Autofill with default values"
272+ override def label : String = _label
273+ override def description (printer : ShortenedTypePrinter )(using Context ): String = descriptionText
274+ override def filterText : Option [String ] = Some (label + " " + descriptionText)
271275
272276 case class Keyword (label : String , override val insertText : Option [String ])
273277 extends CompletionValue :
Original file line number Diff line number Diff line change @@ -339,9 +339,16 @@ object NamedArgCompletions:
339339 s " ${param.nameBackticked.replace(" $" , " $$" )} = $$ { ${index + 1 }${findDefaultValue(param)}} "
340340 }
341341 .mkString(" , " )
342+ val labelText = allParams
343+ .collect {
344+ case param if ! param.symbol.is(Flags .HasDefault ) =>
345+ s " ${param.nameBackticked.replace(" $" , " $$" )} = ??? "
346+ }
347+ .mkString(" , " )
342348 List (
343349 CompletionValue .Autofill (
344- editText
350+ editText,
351+ labelText,
345352 )
346353 )
347354 else List .empty
Original file line number Diff line number Diff line change @@ -1128,3 +1128,16 @@ class CompletionArgSuite extends BaseCompletionSuite:
11281128 """ x: Int
11291129 |x = : Any""" .stripMargin,
11301130 )
1131+
1132+ @ Test def `autofill-arguments-case-class` =
1133+ check(
1134+ """
1135+ |case class A(x: Int, y: Int)
1136+ |
1137+ |def main() =
1138+ | A(x@@)
1139+ |""" .stripMargin,
1140+ """ x = : Int
1141+ |x = ???, y = ???Autofill with default values""" .stripMargin,
1142+ // this looks strange due to the Autofill message belonging to the description
1143+ )
You can’t perform that action at this time.
0 commit comments