Skip to content

Commit

Permalink
revert signature change
Browse files Browse the repository at this point in the history
  • Loading branch information
rochala authored and bishabosha committed Oct 18, 2022
1 parent a73bbd8 commit f1eed51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 8 additions & 2 deletions compiler/src/dotty/tools/dotc/util/Signatures.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ object Signatures {
/**
* Extract (current parameter index, function index, functions) out of a method call.
*
* @param enclosingApply Enclosing function application
* @param path The path to the function application
* @param span The position of the cursor
* @return A triple containing the index of the parameter being edited, the index of the function
* being called, the list of overloads of this function).
*/
def callInfo(enclosingApply: Option[tpd.Tree], span: Span)(using Context): (Int, Int, List[SingleDenotation]) =
def callInfo(path: List[tpd.Tree], span: Span)(using Context): (Int, Int, List[SingleDenotation]) =
val enclosingApply = path.find {
case Apply(fun, _) => !fun.span.contains(span)
case UnApply(fun, _, _) => !fun.span.contains(span)
case _ => false
}

enclosingApply.map {
case UnApply(fun, _, patterns) => callInfo(span, patterns, fun, Signatures.countParams(fun))
case Apply(fun, params) => callInfo(span, params, fun, Signatures.countParams(fun))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,7 @@ class DottyLanguageServer extends LanguageServer

val pos = sourcePosition(driver, uri, params.getPosition)
val trees = driver.openedTrees(uri)
val path = Interactive.pathTo(trees, pos).find {
case Apply(fun, _) => !fun.span.contains(pos.span)
case UnApply(fun, _, _) => !fun.span.contains(pos.span)
case _ => false
}

val path = Interactive.pathTo(trees, pos)
val (paramN, callableN, alternatives) = Signatures.callInfo(path, pos.span)
val signatureInfos = alternatives.flatMap(Signatures.toSignature)

Expand Down

0 comments on commit f1eed51

Please sign in to comment.