brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Declaration lookup in JS #2331

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by soswow Wednesday Dec 26, 2012 at 10:57 GMT Originally opened as https://github.com/adobe/brackets/issues/2445


This is the only feature missing that really force me to use Brackets' Big brother IDEs. I want to quickly find declaration source for any variable, property etc in JS 1) By clicking with Cmd on JS tokens, that are declared somewhere 2) By pressing some shortcut (like Cmd+B) 3) If declaration source is ambigues show hint popup with all possibilities, if declaration is definite - go to the declaration place

In Intellij IDEA it indexes all the project source code and shows declarations found in all files. I think first one file lookup can be enough.

This is defiantly looks like an extension. It makes much easier navigation through a new codebase. But maybe it's too heavy for light editor

core-ai-bot commented 3 years ago

Comment by TomMalbran Wednesday Dec 26, 2012 at 19:55 GMT


Try using Ctrl+T in Windows or in the Navigation menu click on Go to Definition.

core-ai-bot commented 3 years ago

Comment by soswow Wednesday Dec 26, 2012 at 20:30 GMT


I know about this feature, thx. But definition and declaration are not the same things. And definition works only for functions, where I talk about any type of declaration:

And maybe something else I forgot.

core-ai-bot commented 3 years ago

Comment by pthiess Monday Jan 07, 2013 at 19:29 GMT


@RaymondLim - Hey I think you did some bonus work here, can you please comment on how far we already got. I will put (the rest of) it into a trello card if there isn't one already.

THX, Peter

core-ai-bot commented 3 years ago

Comment by peterflynn Friday Jan 11, 2013 at 21:47 GMT


Sounds like the same request as #1217, which is now recorded as this user story: https://trello.com/card/go-to-definition-function-across-files/4f90a6d98f77505d7940ce88/669.

@soswow: is your expectation that this only finds definitions in the current file, or that it searches all files in the project? Also, given the ambiguity inherent in JS, what do you picture happening when multiple potential definitions are found? (This is part of why we've been pushing JS Quick Edit more than "go to" -- it handles ambiguity / multiple results more elegantly).

core-ai-bot commented 3 years ago

Comment by soswow Friday Jan 11, 2013 at 22:24 GMT


Yes, basically what I want is superset of #1217 Quick Edit is just for the function statement lookup, which is not enough. I am talking about all other different declarations.

Video is worth of thousand words: http://www.youtube.com/watch?v=bW8HxIuyeDc This is Intelij IDEA. As you can see it can navigate: 1) Closest scope declaration lookup (see how it finds closest abc) 2) It finds Argument declaration 3) Finds Object property declaration 4) In the end you can see how it handles multiple function statement in 2 different files.

I think lookup in scope of one file is enough. It would be good start. Searching in multiple files requires indexing as it done in Intellij.

core-ai-bot commented 3 years ago

Comment by peterflynn Friday Apr 19, 2013 at 22:24 GMT


@soswow I believe your request will be covered by the Tern code intelligence we're integrating this sprint, which includes a "Jump to Definition" command. (Tern is an open-source JS code intelligence library that we're integrating into Brackets with the help of the Adobe LCVM team).

This covers 1-3 in your list but it is smart enough to operate across files, not just within the current file. I'm not sure how ambiguous references (the 4th item in your list) is handled. In general, because Tern's type inferencing is pretty good, there won't be that many ambiguous cases. But I suspect if something is truly ambiguous it will pick a "best guess" rather than showing a dropdown. That's something we could consider approving upon later.

If you want to play with it, you can try the research fork of Brackets or just wait a week and download our Sprint 24 build when it comes out. If that feels good enough, then please go ahead and close this issue.

core-ai-bot commented 3 years ago

Comment by pthiess Friday May 10, 2013 at 20:16 GMT


I think the Tern Stuff is covering this - closing this a s fixed.