Closed OliverJAsh closed 10 years ago
That is how jump-to-def always works for local variables -- it takes you to the variable's definition. In this case, the parameter. I guess there's a case to be made for having a mode where it tries to go to the definition of the type of the variable, but that doesn't always apply (and as far as most of Tern is concerned, the arguments to a define
or requirejs
call body are normal parameters).
That makes sense. Just realised that jump-to-def will work if your AMD module is an object with properties defined on it. When you jump to those, then it will take you to the AMD definition.
I half expected it to take me to the AMD definition when using jump-to-def on the function parameter, but I understand why it doesn't. Is there any other way this could be achieved?
Thanks for your amazing work.
If you remove the if (!span)
part on line 691 in lib/tern.js
, it'll behave the way you want in this situation—but it'll behave badly in other situations, so I don't want to simply make that change. You could add an option to the definition
request that puts it into this mode (prefer the type's location over the variable's location), and add a binding in the sublime plugin that looks for a definition using this mode.
I don't think I'm going to add this feature seeing as I now realise how it's supposed to work, but thanks for explaining. :-)
I am using the RequireJS plugin that comes with Tern. Although autocomplete is working for AMD dependencies, I cannot jump to the AMD definition. It simply takes me to the function parameter that references the dependency in the current module.
Not sure if this is an issue with this package or something more. Please advise.