Skip to content

Commit ff459b1

Browse files
committed
revert signature change
1 parent b7a391a commit ff459b1

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

compiler/src/dotty/tools/dotc/util/Signatures.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@ object Signatures {
4242
/**
4343
* Extract (current parameter index, function index, functions) out of a method call.
4444
*
45-
* @param enclosingApply Enclosing function application
45+
* @param path The path to the function application
4646
* @param span The position of the cursor
4747
* @return A triple containing the index of the parameter being edited, the index of the function
4848
* being called, the list of overloads of this function).
4949
*/
50-
def callInfo(enclosingApply: Option[tpd.Tree], span: Span)(using Context): (Int, Int, List[SingleDenotation]) =
50+
def callInfo(path: List[tpd.Tree], span: Span)(using Context): (Int, Int, List[SingleDenotation]) =
51+
val enclosingApply = path.find {
52+
case Apply(fun, _) => !fun.span.contains(span)
53+
case UnApply(fun, _, _) => !fun.span.contains(span)
54+
case _ => false
55+
}
56+
5157
enclosingApply.map {
5258
case UnApply(fun, _, patterns) => callInfo(span, patterns, fun, Signatures.countParams(fun))
5359
case Apply(fun, params) => callInfo(span, params, fun, Signatures.countParams(fun))

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,7 @@ class DottyLanguageServer extends LanguageServer
556556

557557
val pos = sourcePosition(driver, uri, params.getPosition)
558558
val trees = driver.openedTrees(uri)
559-
val path = Interactive.pathTo(trees, pos).find {
560-
case Apply(fun, _) => !fun.span.contains(pos.span)
561-
case UnApply(fun, _, _) => !fun.span.contains(pos.span)
562-
case _ => false
563-
}
564-
559+
val path = Interactive.pathTo(trees, pos)
565560
val (paramN, callableN, alternatives) = Signatures.callInfo(path, pos.span)
566561
val signatureInfos = alternatives.flatMap(Signatures.toSignature)
567562

0 commit comments

Comments
 (0)