vmware-archive / scripted

The Scripted code editor
Eclipse Public License 1.0
1.56k stars 166 forks source link

weird navigation behaviour with ctrl+click #166

Open aclement opened 11 years ago

aclement commented 11 years ago

I thought this was moving to the new editor but it seems to happen on master. Open something like scripted.js, line 100 there is an 'info' call:

sLogger.info("No .jshintrc found");

now ctrl+click on info, it takes you to the info further up the page...rather than the declaration? What is it doing? Am I doing something wrong? I've seen it in other places in the codebase too.

aeisenberg commented 11 years ago

sLogger is passed into the function as a parameter and it is not coming through as a module. So, we are not really inferring the real scriptedLogger. We are only inferring that the reference to info is the same reference as used above. So, you are just navigated to the first known use of info.

I think we can do better here by being dumber.

  1. we should be able to recognize that the first known use of info is not really a declaration, but a use
  2. We should also be able to find somewhere in our file summaries the real declaration of info.
  3. And although we won't be able to tell definitively that the declaration of info corresponds to the use of info where you press ctrl+click, it's actually a pretty good guess. And we should just go there.
  4. In the case where this non-inferencing finding comes up with multiple answers, then perhaps we can have a little popup that displays all of them and you can choose.

The only wrinkle that I can see here is that currently, the only way that we can find the actual definition is if the scriptedLogger is transitively depended on by the current file, and if it's not, then I don't know how to find it.