Giter VIP home page Giter VIP logo

Comments (4)

marijnh avatar marijnh commented on September 15, 2024

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).

from tern_for_sublime.

OliverJAsh avatar OliverJAsh commented on September 15, 2024

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.

from tern_for_sublime.

marijnh avatar marijnh commented on September 15, 2024

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.

from tern_for_sublime.

OliverJAsh avatar OliverJAsh commented on September 15, 2024

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. :-)

from tern_for_sublime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.