@@ -117,19 +117,6 @@ object MetalsInteractive:
117
117
): List [(Symbol , Type , Option [String ])] =
118
118
import indexed .ctx
119
119
path match
120
- // Handle select on named tuples
121
- case (Apply (Apply (TypeApply (fun, List (t1, t2)), List (ddef)), List (Literal (Constant (i : Int ))))) :: _
122
- if fun.symbol.exists && fun.symbol.name == nme.apply &&
123
- fun.symbol.owner.exists && fun.symbol.owner == getModuleIfDefined(" scala.NamedTuple" ).moduleClass =>
124
- def getIndex (t : Tree ): Option [Type ] =
125
- t.tpe.dealias match
126
- case AppliedType (_, args) => args.get(i)
127
- case _ => None
128
- val name = getIndex(t1) match
129
- case Some (c : ConstantType ) => c.value.stringValue
130
- case _ => " "
131
- val tpe = getIndex(t2).getOrElse(NoType )
132
- List ((ddef.symbol, tpe, Some (name)))
133
120
// For a named arg, find the target `DefDef` and jump to the param
134
121
case NamedArg (name, _) :: Apply (fn, _) :: _ =>
135
122
val funSym = fn.symbol
@@ -216,6 +203,20 @@ object MetalsInteractive:
216
203
case _ =>
217
204
Nil
218
205
206
+ // Handle select on named tuples
207
+ case (Apply (Apply (TypeApply (fun, List (t1, t2)), List (ddef)), List (Literal (Constant (i : Int ))))) :: _
208
+ if fun.symbol.exists && fun.symbol.name == nme.apply &&
209
+ fun.symbol.owner.exists && fun.symbol.owner == getModuleIfDefined(" scala.NamedTuple" ).moduleClass =>
210
+ def getIndex (t : Tree ): Option [Type ] =
211
+ t.tpe.dealias match
212
+ case AppliedType (_, args) => args.get(i)
213
+ case _ => None
214
+ val name = getIndex(t1) match
215
+ case Some (c : ConstantType ) => c.value.stringValue
216
+ case _ => " "
217
+ val tpe = getIndex(t2).getOrElse(NoType )
218
+ List ((ddef.symbol, tpe, Some (name)))
219
+
219
220
case path @ head :: tail =>
220
221
if head.symbol.is(Exported ) then
221
222
val sym = head.symbol.sourceSymbol
0 commit comments