Intellisense / Code Completion not working for new added files (Django)

May 28, 2013 at 3:43 PM
Edited May 28, 2013 at 3:45 PM
Hi!

I have a strange behavior in my PTVS installation. The code completion and intellisense is not working for manual added files in my Django project.

If i add for example admin.py to the project folder i don't have intellisense for that file. For all other files created by the wizzard the completion is working fine.

What could be the problem?

( I am using VS2012 Integrated Shell and PTVS 2.0)

Thanks!
Coordinator
May 28, 2013 at 4:31 PM
Does the file show up in the Solution Explorer window under your project? If you copied the file into the folder directly and didn't use the "Add Existing Item" tool in VS then we won't treat the file as part of the project.

To fix this now, you can right-click on the project (or click the Project menu) and select Add Existing Item.

We have some changes coming in 2.0 beta that will improve this, but the general rule for Visual Studio is that you should avoid changing the file system directly. Practically everything can be done using VS itself.

(Some background: Visual Studio uses a concept of projects that is not the same as putting files in a folder - it's more like a makefile. If you have a file on disk but it isn't listed in the project, we won't treat it as part of the project. This means we won't do cross-module analysis ["cross with what? this is just a random file!"] and if you deploy your site using VS then the file won't be included.)

If the file is included in the project already, then you may be importing the module with an incorrect name or some name that we aren't recognizing (search paths, or runtime modifications to sys.path, maybe?). If your project runs with F5 in VS but we don't show completions, that's our fault (and we'd like to know, so we can fix it).

Let me know if any of that helps.
May 28, 2013 at 4:41 PM
Hi Zooba,

no i added the file from within the project (right click, add new item...) I see the file in the solution explorer.

If i start typing "import ..." i get no modules to select. Just nothing. Running the project with F5 works fine, but no completion for these particular files.
Coordinator
May 28, 2013 at 5:09 PM
Can you zip up your project and email it to ptvshelp@microsoft.com? I'd love to take a look at it.
May 28, 2013 at 7:55 PM
Zooba after trying and trying i got it working. I clicked on "rebuild solution" and after that the problem was solved.

Many thanks!
Coordinator
May 28, 2013 at 8:55 PM
Great to hear! And thanks for letting us know how you fixed it.