@@ -54,10 +54,10 @@ final class InferredMethodProvider(
5454 def inferredMethodEdits (
5555 adjustOpt : Option [AdjustTypeOpts ] = None
5656 ): List [TextEdit ] =
57- val uri = params.uri().nn
58- val filePath = Paths .get(uri).nn
57+ val uri = params.uri()
58+ val filePath = Paths .get(uri)
5959
60- val sourceText = adjustOpt.map(_.text).getOrElse(params.text().nn )
60+ val sourceText = adjustOpt.map(_.text).getOrElse(params.text())
6161 val source =
6262 SourceFile .virtual(filePath.toString(), sourceText)
6363 driver.run(uri, source)
@@ -101,8 +101,8 @@ final class InferredMethodProvider(
101101 .mkString(" , " )
102102
103103 def printSignature (
104- methodName : Name ,
105- params : List [List [Type ]],
104+ methodName : Name ,
105+ params : List [List [Type ]],
106106 retTypeOpt : Option [Type ]
107107 ): String =
108108 val retTypeString = retTypeOpt match
@@ -145,15 +145,15 @@ final class InferredMethodProvider(
145145 /**
146146 * Returns the position to insert the method signature for a container.
147147 * If the container has an empty body, the position is the end of the container.
148- * If the container has a non-empty body, the position is the end of the last element in the body.
149- *
148+ * If the container has a non-empty body, the position is the end of the last element in the body.
149+ *
150150 * @param container the container to insert the method signature for
151151 * @return the position to insert the method signature for the container and a boolean indicating if the container has an empty body
152152 */
153153 def insertPositionFor (container : Tree ): Option [(SourcePosition , Boolean )] =
154154 val typeSymbol = container.tpe.widenDealias.typeSymbol
155155 if typeSymbol.exists then
156- val trees = driver.openedTrees(params.uri().nn )
156+ val trees = driver.openedTrees(params.uri())
157157 val include = Interactive .Include .definitions | Interactive .Include .local
158158 Interactive .findTreesMatching(trees, include, typeSymbol).headOption match
159159 case Some (srcTree) =>
@@ -170,9 +170,9 @@ final class InferredMethodProvider(
170170
171171 /**
172172 * Extracts type information for a specific parameter in a method signature.
173- * If the parameter is a function type, extracts both the function's argument types
173+ * If the parameter is a function type, extracts both the function's argument types
174174 * and return type. Otherwise, extracts just the parameter type.
175- *
175+ *
176176 * @param methodType the method type to analyze
177177 * @param argIndex the index of the parameter to extract information for
178178 * @return a tuple of (argument types, return type) where:
@@ -192,7 +192,7 @@ final class InferredMethodProvider(
192192 else
193193 (None , Some (m.paramInfos(argIndex)))
194194 case _ => (None , None )
195-
195+
196196 def signatureEdits (signature : String ): List [TextEdit ] =
197197 val pos = insertPosition()
198198 val indent = indentation(params.text(), pos.start - 1 )
@@ -234,17 +234,17 @@ final class InferredMethodProvider(
234234 * outerArgs
235235 * ---------------------------
236236 * method(..., errorMethod(args), ...)
237- *
237+ *
238238 */
239- case (id @ Ident (errorMethod)) ::
240- (apply @ Apply (func, args)) ::
241- Apply (method, outerArgs) ::
239+ case (id @ Ident (errorMethod)) ::
240+ (apply @ Apply (func, args)) ::
241+ Apply (method, outerArgs) ::
242242 _ if id.symbol == NoSymbol && func == id && method != apply =>
243-
243+
244244 val argTypes = args.map(_.typeOpt.widenDealias)
245245
246246 val argIndex = outerArgs.indexOf(apply)
247- val (allArgTypes, retTypeOpt) =
247+ val (allArgTypes, retTypeOpt) =
248248 extractParameterTypeInfo(method.tpe.widenDealias, argIndex) match
249249 case (Some (argTypes2), retTypeOpt) => (List (argTypes, argTypes2), retTypeOpt)
250250 case (None , retTypeOpt) => (List (argTypes), retTypeOpt)
@@ -257,12 +257,12 @@ final class InferredMethodProvider(
257257 * outerArgs
258258 * ---------------------
259259 * method(..., errorMethod, ...)
260- *
260+ *
261261 */
262- case (id @ Ident (errorMethod)) ::
263- Apply (method, outerArgs) ::
262+ case (id @ Ident (errorMethod)) ::
263+ Apply (method, outerArgs) ::
264264 _ if id.symbol == NoSymbol && method != id =>
265-
265+
266266 val argIndex = outerArgs.indexOf(id)
267267
268268 val (argTypes, retTypeOpt) = extractParameterTypeInfo(method.tpe.widenDealias, argIndex)
@@ -272,20 +272,20 @@ final class InferredMethodProvider(
272272 case None => Nil
273273
274274 val signature = printSignature(errorMethod, allArgTypes, retTypeOpt)
275-
275+
276276 signatureEdits(signature)
277277
278278 /**
279279 * tpt body
280280 * ----------- ----------------
281281 * val value: DefinedType = errorMethod(args)
282- *
282+ *
283283 */
284- case (id @ Ident (errorMethod)) ::
285- (apply @ Apply (func, args)) ::
286- ValDef (_, tpt, body) ::
284+ case (id @ Ident (errorMethod)) ::
285+ (apply @ Apply (func, args)) ::
286+ ValDef (_, tpt, body) ::
287287 _ if id.symbol == NoSymbol && func == id && apply == body =>
288-
288+
289289 val retType = tpt.tpe.widenDealias
290290 val argTypes = args.map(_.typeOpt.widenDealias)
291291
@@ -296,24 +296,24 @@ final class InferredMethodProvider(
296296 * tpt body
297297 * ----------- -----------
298298 * val value: DefinedType = errorMethod
299- *
299+ *
300300 */
301- case (id @ Ident (errorMethod)) ::
302- ValDef (_, tpt, body) ::
301+ case (id @ Ident (errorMethod)) ::
302+ ValDef (_, tpt, body) ::
303303 _ if id.symbol == NoSymbol && id == body =>
304-
304+
305305 val retType = tpt.tpe.widenDealias
306306
307307 val signature = printSignature(errorMethod, Nil , Some (retType))
308308 signatureEdits(signature)
309309
310310 /**
311- *
311+ *
312312 * errorMethod(args)
313- *
313+ *
314314 */
315- case (id @ Ident (errorMethod)) ::
316- (apply @ Apply (func, args)) ::
315+ case (id @ Ident (errorMethod)) ::
316+ (apply @ Apply (func, args)) ::
317317 _ if id.symbol == NoSymbol && func == id =>
318318
319319 val argTypes = args.map(_.typeOpt.widenDealias)
@@ -322,37 +322,37 @@ final class InferredMethodProvider(
322322 signatureEdits(signature)
323323
324324 /**
325- *
325+ *
326326 * errorMethod
327- *
327+ *
328328 */
329- case (id @ Ident (errorMethod)) ::
329+ case (id @ Ident (errorMethod)) ::
330330 _ if id.symbol == NoSymbol =>
331331
332332 val signature = printSignature(errorMethod, Nil , None )
333333 signatureEdits(signature)
334334
335335 /**
336- *
336+ *
337337 * container.errorMethod(args)
338- *
338+ *
339339 */
340- case (select @ Select (container, errorMethod)) ::
341- (apply @ Apply (func, args)) ::
340+ case (select @ Select (container, errorMethod)) ::
341+ (apply @ Apply (func, args)) ::
342342 _ if select.symbol == NoSymbol && func == select =>
343-
343+
344344 val argTypes = args.map(_.typeOpt.widenDealias)
345345 val signature = printSignature(errorMethod, List (argTypes), None )
346346 signatureEditsForContainer(signature, container)
347347
348348 /**
349- *
349+ *
350350 * container.errorMethod
351- *
351+ *
352352 */
353- case (select @ Select (container, errorMethod)) ::
353+ case (select @ Select (container, errorMethod)) ::
354354 _ if select.symbol == NoSymbol =>
355-
355+
356356 val signature = printSignature(errorMethod, Nil , None )
357357 signatureEditsForContainer(signature, container)
358358
0 commit comments