Implementing web2py framework support.

May 17, 2012 at 1:34 PM

Hi, 

the new release of PTVS 1.5 Alpha come with Django support which is nice in less than 5 minutes I was already having Django running from VS10. So I think in this early stage before the project get more involved I think it should be design or documented all the step in such a way that for those of us that would like to implement other framework support to the PTVS can have a more easier way to since I'm guessing the logic of the module/project itself should be reusable enough to migrate others framework and this will help on build a bigger community for PTVS.

Coordinator
May 17, 2012 at 5:27 PM

I'm not sure we have the time to document everything, but I'm certainly willing to answer any questions you have along the way.

In general you should be able to look at the Django project and fork it to add support for WebPy.  If you do literally fork it you'll want to do a pass through the project and update all of the various unique GUIDs to be new unique GUIDs.  The Django project is it's own VS package and it implements a "flavored project" which allows customization of the project system which lives outside of the core of PTVS.

From there it depends on basically what new features you want.  If you just want to add some templates for File->New Project you don't even necessarily need a new flavored project, but you can update the ones which the flavored project installs (these are in the Templates folder).

If you want to support a templating engine you'll need to implement all the support for parsing the template files and you can look at the projection buffer support in the Django project which shows how to get both normal editing as well as template editing in the same file.

If you want to add some additional commands such as Validate Django app you can look at this support which starts in the Django.vsct file and look at how the same cmd ID (which is listed in PkgCmdId.cs) is wired up and handled elsewhere in the project.

If you want to improve the intellisense experience dramatically you can look at the specializations that the Django project includes where it customizes certain Django methods so that we can plug-in to the intellisense experience.

If you want to add custom WebPy debugger support you can just go ahead and update the existing debugger to conditionally enable WebPy support which is what we did for Django.

I think that covers most of the interesting things the Django project does, but if you think I missed something or would like more information about any one of these let me know and I can provide some more details.