Scripting "Find Usages"

I have been reverse engineering a large project from the database layer up.

"Find Usages" has been helpful, but I would like to be able to automate this process instead of this "click -> wait for progress bar -> log results -> click -> wait for progress bar -> etc."

Is there a way to write a script or code against that functionality?

Thanks in advance,
Jonathan

5 comments

Hello Jonathan,

Do you mean exploring call stacks from source code? Or some other kind of
researching the project?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


JM> I have been reverse engineering a large project from the database
JM> layer up.
JM>
JM> "Find Usages" has been helpful, but I would like to be able to
JM> automate this process instead of this "click -> wait for progress
JM> bar -> log results -> click -> wait for progress bar -> etc."
JM>
JM> Is there a way to write a script or code against that functionality?
JM>
JM> Thanks in advance,
JM> Jonathan
JM> ---
JM> Original message URL:
JM> http://www.jetbrains.net/devnet/message/5239338#5239338


0

What I am attempting to do is, for a given method, determine all methods that call that, and all methods that call that, all the way up to UI input.

Example: I start at Person.Create() and click "Find Usages", which leads to Administrator.Create(), then Organization.Create(), then Company.Create(), then Form.CompanyButton_Add().

To do that, I have to click "Find Usages" 4 times, which might take 2 minutes each time.  So, I sit, wait and watch a progress bar for 2 minutes.  Then 10 seconds of activity to scroll up and click "Find Usages" again.  And another 2 minute wait.

I would like to be able to write some code to call "Find Usages" programatically, determine the calling methods, and call "Find Usages" on those, until we are at the top level.  Thus, I can start the process and do something else while it completes.  I'd rather wait for 8 minutes total, than 4 times for 2 minutes.

Is there a way to access the Resharper API so that I could write something like that?

0

Hello Jonathan,

That's definitly possible, but would require quite a lot of work. If you
want to do it, welcome to OpenAPI forum.

Note, that in ReSharper 5 we will introduce new tools for code analysis.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> What I am attempting to do is, for a given method, determine all
IR> methods that call that, and all methods that call that, all the way
IR> up to UI input.
IR>
IR> Example: I start at Person.Create() and click "Find Usages", which
IR> leads to Administrator.Create(), then Organization.Create(), then
IR> Company.Create(), then Form.CompanyButton_Add().
IR>
IR> To do that, I have to click "Find Usages" 4 times, which might take
IR> 2 minutes each time. So, I sit, wait and watch a progress bar for 2
IR> minutes. Then 10 seconds of activity to scroll up and click "Find
IR> Usages" again. And another 2 minute wait.
IR>
IR> I would like to be able to write some code to call "Find Usages"
IR> programatically, determine the calling methods, and call "Find
IR> Usages" on those, until we are at the top level. Thus, I can start
IR> the process and do something else while it completes. I'd rather
IR> wait for 8 minutes total, than 4 times
IR> for 2 minutes.
IR> Is there a way to access the Resharper API so that I could write
IR> something like that?
IR>
IR> ---
IR> Original message URL:
IR> http://www.jetbrains.net/devnet/message/5239380#5239380


0

> To do that, I have to click "Find Usages" 4 times, which might take 2 minutes each time.  So, I sit, wait and watch a progress bar for 2 minutes. 

2 minutes for "find usages"? Are you sure you're using the R# "find usages" and not the Visual Studio built-in function? When I use "find usages", it usually takes 1 sec or less (and it is a large solution).

0

Yes, 2 minutes per R# "Find Usages", not Visual Studio's.  It seems to me to be opening and scanning every file in the solution every time, instead of searching a tree or index in memory.

Sometimes it takes 2 seconds, sometimes it takes 30, and sometimes it takes 2 minutes.  However, most of the methods I've been working with, which aren't used anywhere, take about 2 minutes.

The solution is VB.NET, and ASP.NET.  I haven't done any line-count or file-count, but according to a colleague, there are 1300 aspx/ascx files.  (I'm new to the project as of last Tuesday.)

I'll get more info to you when I can; probably tomorrow.

0

Please sign in to leave a comment.