Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create Call Hierarchy View. #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andrey-ilinykh
Copy link

It is written o the top of Find Occurrences API. One field (caller offset) is added to lucent index. This field is used to build the hierarchy.

Fix #1000872

It is written o the top of Find Occurrences  API. One field (caller offset) is added to lucent index. This field is used to build the  hierarchy.

Fix #1000872
@ghprb-bot
Copy link

org.eclipse.search,
org.eclipse.core.databinding.beans;bundle-version="1.2.200",
org.eclipse.jface.databinding;bundle-version="1.6.200",
org.eclipse.core.databinding.property;bundle-version="1.4.200"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the bundle versions here. If none is used, the latest version available will be used. That should make updates to new Eclipse versions easier/possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you want to use version ranges to avoid error at runtime due to binary incompatibilities?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't know what ranges to put in here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know either, but usually Eclipse follows semantic versioning .

@kiritsuku
Copy link
Member

The code mostly looks good. I still have to check it for its functionality but probably can't due this before tomorrow. A note for future: It would be nice if you could split up formatting changes in their own commit. This makes review a lot easier. Also you shouldn't just format the existing code but also format your own. There are a few inconsistencies in the new Scala files - it doesn't look like you invoked auto formatting there.

@ghprb-bot
Copy link

@andrey-ilinykh
Copy link
Author

This plugin doesn't use scalastyle plugin, so formatting is inconsistent. Should I add it?

@kiritsuku
Copy link
Member

On 12/17/2015 07:45 AM, Andrey Ilinykh wrote:

This plugin doesn't use scalastyle plugin, so formatting is
inconsistent. Should I add it?

You can but beside from trailing whitespace we don't even check anything
in the scala-ide main repo. In general I think most style rules are not
useful.

@kiritsuku
Copy link
Member

In the caller column, there are arrows shown, even when they can't be expanded. They should not be shown in this case.

@kiritsuku
Copy link
Member

I don't think it is necessary to show the "content" column in the call hierarchy, one can click on the line to get to the code directly.

@kiritsuku
Copy link
Member

When I have

  def foo: Int = {
    def x = {
      bar
    }
    x
  }
  def goo = bar
  def bar = 0

inside of x, foo is shown twice. Not sure where the second entry is coming from.

EDIT: Ok, I get it now. One is coming from the call of x and the other is the declaration of x. If both are shown, then the declaration of x should be shown nested in the call of x, WDYT?

@kiritsuku
Copy link
Member

I got the following NPE:

2015-12-18 12:48:48,179 DEBUG [main] - System.out - java.lang.NullPointerException
    at org.scala.tools.eclipse.search.Util$.scalaSourceFileFromIFile(Util.scala:32)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2$$anonfun$apply$4.apply(Util.scala:26)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2$$anonfun$apply$4.apply(Util.scala:21)
    at scala.Option.flatMap(Option.scala:171)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2.apply(Util.scala:21)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2.apply(Util.scala:19)
    at scala.Option.flatMap(Option.scala:171)
    at org.scala.tools.eclipse.search.Util$.scalaSourceFileFromAbstractFile(Util.scala:19)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler.org$scala$tools$eclipse$search$searching$SearchPresentationCompiler$$symbolToEntity(SearchPresentationCompiler.scala:78)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$entityAt$1$$anonfun$4.apply(SearchPresentationCompiler.scala:56)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$entityAt$1$$anonfun$4.apply(SearchPresentationCompiler.scala:56)
    at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26)
    at scala.tools.nsc.interactive.Global$$anonfun$pollForWork$1.apply$mcV$sp(Global.scala:457)
    at scala.util.control.Breaks.breakable(Breaks.scala:38)
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:431)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)
2015-12-18 12:48:48,179 ERROR [main] - org.scala-ide.sdt.core - org.scala-ide.sdt.core - org.scala-ide.sdt.core - 0 - Throwable during asyncExec
java.lang.NullPointerException
    at org.scala.tools.eclipse.search.Util$.scalaSourceFileFromIFile(Util.scala:32)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2$$anonfun$apply$4.apply(Util.scala:26)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2$$anonfun$apply$4.apply(Util.scala:21)
    at scala.Option.flatMap(Option.scala:171)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2.apply(Util.scala:21)
    at org.scala.tools.eclipse.search.Util$$anonfun$scalaSourceFileFromAbstractFile$2.apply(Util.scala:19)
    at scala.Option.flatMap(Option.scala:171)
    at org.scala.tools.eclipse.search.Util$.scalaSourceFileFromAbstractFile(Util.scala:19)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler.org$scala$tools$eclipse$search$searching$SearchPresentationCompiler$$symbolToEntity(SearchPresentationCompiler.scala:78)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$entityAt$1$$anonfun$4.apply(SearchPresentationCompiler.scala:56)
    at org.scala.tools.eclipse.search.searching.SearchPresentationCompiler$$anonfun$entityAt$1$$anonfun$4.apply(SearchPresentationCompiler.scala:56)
    at scala.tools.nsc.util.InterruptReq.execute(InterruptReq.scala:26)
    at scala.tools.nsc.interactive.Global$$anonfun$pollForWork$1.apply$mcV$sp(Global.scala:457)
    at scala.util.control.Breaks.breakable(Breaks.scala:38)
    at scala.tools.nsc.interactive.Global.pollForWork(Global.scala:431)
    at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:22)

@kiritsuku
Copy link
Member

I just checked the feature on the following example but it didn't work for a single case:

package test

import akka.actor._

case object PingMessage
case object PongMessage
case object StartMessage
case object StopMessage

class Ping(pong: ActorRef) extends Actor {
  var count: Int = 0
  def incrementAndPrint(): Unit = { count += 1; println("ping") }
  override def receive: PartialFunction[Any, Unit] = {
    case StartMessage 
      incrementAndPrint
      pong ! PingMessage
    case PongMessage 
      incrementAndPrint
      if (count > 10) {
        sender ! StopMessage
        println("ping stopped")
        context.stop(self)
      } else {
        sender ! PingMessage
      }
  }
}

class Pong extends Actor {
  override def receive: PartialFunction[Any, Unit] = {
    case PingMessage 
      println("  pong")
//      sender ! PoisonPill
      sender ! PongMessage
    case StopMessage 
      println("pong stopped")
      context.stop(self)
  }
}

object PingPongTest extends App {
  val system: akka.actor.ActorSystem = ActorSystem("PingPongSystem")
  val pong: akka.actor.ActorRef = system.actorOf(Props[Pong], name = "pong")
  val ping: akka.actor.ActorRef = system.actorOf(Props(new Ping(pong)), name = "ping")
  // start them going
  ping ! StartMessage

  //  Thread.sleep(10000)
  //  system.shutdown()
}

On other examples it worked better. Not sure what the problem here is.

@kiritsuku
Copy link
Member

Another example where nothing is shown:

class SomeTestClass {
  def foo(silent: Boolean) = {
    (new Inner1).inner.foo()
  }
  private class Inner1 {
    def inner = Inner

    object Inner {
      def foo(silent: Boolean = false): String =
        "trala".nonEmpty.toString() // <- BREAKPOINT HERE
    }
  }
}

Not sure if inner or foo are already supposed to work. In general it would be nice if you could add tests for the cases that are supposed to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants