Source Panel should support cmd-click for functions

14 views
Skip to first unread message

Jason Laster

unread,
Apr 2, 2015, 9:47:53 AM4/2/15
to google-chrome-...@googlegroups.com
Hey DevTools! Just following up on cmd-click issue.

It'd be great if command clicking on a function jumped to the function definition. This is a fairly common IDE feature, that makes code navigation a little bit more fluid.

The problem is that there isn't a static mapping between function calls and their defintions. I think one solution, would be to have cmd-click launch the "go to member" popup with the function as the query.

Here's a preview of how that might look.


-- 

Jason Laster
Software Engineer
  Etsy  

Pavel Feldman

unread,
Apr 2, 2015, 10:21:10 AM4/2/15
to Google Chrome Developer Tools
That'd only work in one file though, which looks like a serios limitation. They way IDEs implement this feature is via doing something similar to the actual compilation. This includes parsing, building AST and complete source code model. I don't think there is an easy solution that would provide reasonable results that would not be doing something like that.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/CAH_2F5Gjp0%3DzBrT405DBBmNZ%2BWR3%3DP_EzuyZ1OqFYbaUJv-U0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jason Laster

unread,
Apr 2, 2015, 10:41:14 AM4/2/15
to google-chrome-...@googlegroups.com
Thanks for the quick response pavel

On Thu, Apr 2, 2015 at 10:21 AM, Pavel Feldman <pfel...@chromium.org> wrote:
That'd only work in one file though, which looks like a serios limitation.

I completely agree. I forgot to mention that adding "go to member" for all files is a dependency. Sandip did some good work on this. I believe there's also an issue for it, but i could not find it.

They way IDEs implement this feature is via doing something similar to the actual compilation. This includes parsing, building AST and complete source code model. I don't think there is an easy solution that would provide reasonable results that would not be doing something like that.

Agreed. Actually, determining if a token that's clicked on is in fact a function is also currently a difficult problem as well. The way the FormatterWorker.JavaScriptOutline deterines if a token is a function requires maintaining a previously seen token. The hacky solution I was considering was to check if the clicked token was in the list of known functions. This has it's limitations, but i think is reasonable given that the user clicked on the identifier.


On Thu, Apr 2, 2015 at 4:47 PM, Jason Laster <jason.l...@gmail.com> wrote:
Hey DevTools! Just following up on cmd-click issue.

It'd be great if command clicking on a function jumped to the function definition. This is a fairly common IDE feature, that makes code navigation a little bit more fluid.

The problem is that there isn't a static mapping between function calls and their defintions. I think one solution, would be to have cmd-click launch the "go to member" popup with the function as the query.

Here's a preview of how that might look.


-- 

Jason Laster
Software Engineer
  Etsy  

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/CAH_2F5Gjp0%3DzBrT405DBBmNZ%2BWR3%3DP_EzuyZ1OqFYbaUJv-U0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Pavel Feldman

unread,
Apr 2, 2015, 10:46:41 AM4/2/15
to Google Chrome Developer Tools
On Thu, Apr 2, 2015 at 5:40 PM, Jason Laster <jason.l...@gmail.com> wrote:
Thanks for the quick response pavel

On Thu, Apr 2, 2015 at 10:21 AM, Pavel Feldman <pfel...@chromium.org> wrote:
That'd only work in one file though, which looks like a serios limitation.

I completely agree. I forgot to mention that adding "go to member" for all files is a dependency. Sandip did some good work on this. I believe there's also an issue for it, but i could not find it.

They way IDEs implement this feature is via doing something similar to the actual compilation. This includes parsing, building AST and complete source code model. I don't think there is an easy solution that would provide reasonable results that would not be doing something like that.

Agreed. Actually, determining if a token that's clicked on is in fact a function is also currently a difficult problem as well. The way the FormatterWorker.JavaScriptOutline deterines if a token is a function requires maintaining a previously seen token. The hacky solution I was considering was to check if the clicked token was in the list of known functions. This has it's limitations, but i think is reasonable given that the user clicked on the identifier.

Yep, but we need to parse the world for that.
 

Jason Laster

unread,
Apr 2, 2015, 10:54:04 AM4/2/15
to google-chrome-...@googlegroups.com
I can appreciate that maintaining a list of known functions per source could be expensive.




For more options, visit https://groups.google.com/d/optout.

Sandip Chitale

unread,
Apr 2, 2015, 12:59:21 PM4/2/15
to google-chrome-...@googlegroups.com
I think there are ways to deal with "parse the world" concern. The functionality will be invoked by the user on demand. And first time it happens the parsing could be done and cached in memory. If the memory pressures get too much then the index could be stored in localstorage and reloaded on demand. Cache browser headers could be used to invalidate the cached index etc. IDEs do that all the time.

In any case, I have been using my implementation on the Devtools source itself - which is a moderately sized codebase. Even without caching, it is quite usable (because of chuncked approach) - and I still prefer it over "search-text-in-all-files" (inaccurate and too many results) alternative.

My 2 cents.

On Thursday, April 2, 2015 at 7:54:04 AM UTC-7, Jason Laster wrote:
I can appreciate that maintaining a list of known functions per source could be expensive.


On Thu, Apr 2, 2015 at 10:46 AM, Pavel Feldman <pfel...@chromium.org> wrote:
On Thu, Apr 2, 2015 at 5:40 PM, Jason Laster <jason.l...@gmail.com> wrote:
Thanks for the quick response pavel

On Thu, Apr 2, 2015 at 10:21 AM, Pavel Feldman <pfel...@chromium.org> wrote:
That'd only work in one file though, which looks like a serios limitation.

I completely agree. I forgot to mention that adding "go to member" for all files is a dependency. Sandip did some good work on this. I believe there's also an issue for it, but i could not find it.

They way IDEs implement this feature is via doing something similar to the actual compilation. This includes parsing, building AST and complete source code model. I don't think there is an easy solution that would provide reasonable results that would not be doing something like that.

Agreed. Actually, determining if a token that's clicked on is in fact a function is also currently a difficult problem as well. The way the FormatterWorker.JavaScriptOutline deterines if a token is a function requires maintaining a previously seen token. The hacky solution I was considering was to check if the clicked token was in the list of known functions. This has it's limitations, but i think is reasonable given that the user clicked on the identifier.

Yep, but we need to parse the world for that.
 
On Thu, Apr 2, 2015 at 4:47 PM, Jason Laster <jason.l...@gmail.com> wrote:
Hey DevTools! Just following up on cmd-click issue.

It'd be great if command clicking on a function jumped to the function definition. This is a fairly common IDE feature, that makes code navigation a little bit more fluid.

The problem is that there isn't a static mapping between function calls and their defintions. I think one solution, would be to have cmd-click launch the "go to member" popup with the function as the query.

Here's a preview of how that might look.


-- 

Jason Laster
Software Engineer
  Etsy  

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.



--

-- 
Jason Laster
Software Engineer
  Etsy  

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-developer-tools+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages