'Go To Definition' no longer working in my project

Jul 12, 2012 at 3:05 PM
Edited Jul 12, 2012 at 3:52 PM

I have a project which if I recall correctly was set up as a Blank Project.

For a while Go To Definition was working fully in that sense that it went to definition both for functions in the same file, and for functions which existed in other files which were in my solution and findable in my IRONPYTHON path.

This has served me well, but suddenly Go To Definition is no longer working for functions that live outside of the file I am currently in.

I have tried to start again from scratch, and aslos tried with project type IronPython Application, but to no avail..

Is there a sequence of steps, or some minimum conditions that need so be followed such that Go To Definition behaves properly?

Many thanks.

PTVS 1.1.1

Coordinator
Jul 12, 2012 at 5:55 PM

Could you have creeped above 300 or so files total between your project and what's in IRONPYTHONPATH?  If so there's a hidden option in HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\PythonTools\Options\Advanced called CrossModuleAnalysisLimit which you can raise (this was misspelled at one point so if you see a misspelled version and not the properly spelled version update the misspelled one). 

We've actually upped this number in 1.5 significantly so it'll be less likely you'll hit it in the future (along with some compensating changes in the analysis engine), but you can tweak it to whatever you want.  But as the number of files grows so will the analysis time when you're doing edits. 

Potentially a better solution is installing the packages that are in IRONPYTHONPATH into site-packages and then running Generate Completions from Tools->Options->Python Tools->Interpreter Options.  We'll keep the completion database offline then but goto def will still work.

Let us know if that doesn't fix it.

Jul 13, 2012 at 10:43 AM
Edited Jul 13, 2012 at 11:08 AM

Thanks for the reply dinov.

When you say "installing the packages that are in IRONPYTHONPATH into site-packages", do you mean moving my files into C:\Program Files (x86)\IronPython 2.7.1\Lib\site-packages?

I think I'm preventing from doing this, since my files belong in a Perforce workspace with a well-defined directory structure. Other users also access the files and check them in and out. (I'm guessing I'm prevented from doing this, but if you meant something else or know of a way of mapping/linking the files, please advise).

My IRONPYTHONPATH is set up thus: <path to my Perforce workspace directories>;C:\Program Files (x86)\IronPython 2.7.1

Separately, I've tried the Generate Completion Database option you suggested. I know you suggested it in conjunction with the site-packages option, but I tried just in case. No joy.

It may not be related, but ever since the Go To Definition problem began, I also see a pop-up on startup telling me that Visual Studio has encountered by an exception. This may be caused by an extension. It points me to C:\Users\<me>\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml. In it, I can see:

  <entry>
    <record>75</record>
    <time>2012/07/13 09:38:55.040</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [Python Tools Package]</description>
    <guid>{6DBD7C1E-1F1B-496D-AC7C-C55DAE66C783}</guid>
  </entry>

then:

  <entry>
    <record>76</record>
    <time>2012/07/13 09:38:55.041</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Python Tools Package]</description>
    <guid>{6DBD7C1E-1F1B-496D-AC7C-C55DAE66C783}</guid>
  </entry>

followed by:

 <entry>
    <record>232</record>
    <time>2012/07/13 09:38:56.534</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Python Tools Package]</description>
    <guid>{6DBD7C1E-1F1B-496D-AC7C-C55DAE66C783}</guid>
  </entry>

Any further guidance much appreciated.

Coordinator
Jul 13, 2012 at 5:08 PM

For the startup issue - do you have any other extensions installed (you can look in Help->About and Tools->Extension Manager to get a list).  I've unfortunately never even seen this error message and it doesn't point to anything specific in PTVS.

Can you try the reg key I mentioned in the earlier post and see if it fixes the goto def issue?

Jul 16, 2012 at 9:22 AM

Dinov, I had neglectd to try the reg key suggestion first time round, as I didn't imagine that the number of files under IRONPYTHONPATH could be > 300. Having reconsidered the size of my Perforce workspace, I have tried that suggestion and indeed it has solved the issue.

Thanks a lot.