Search code examples
c#pythonvisual-studioideptvs

Use PTVS in VS2013 shell for own application


I have written an application which can be extended with IronPython. All scripts are stored in a database and can be edited with ScintillaNet. Every thing works fine, but i don't like ScintillaNet as the script editor because of bad autocomplete and so on.

No i want to use the Visual Studio Shell with PTVS (PlugIn) for editing my python code. What is the best way to do this?

The first option i thought about is creating a kind of plugin which can connect to my database and i can open and edit the scripts from there. But than i have to write a complete VS 2013 plugin...

The second option is, that i save the scripts in the explorer and than open it in Visual Studio. When the script is changed i can write the changes back to the database. (Maybe i could detect the changes with FileSystemWatcher).

But this two ways seems not to be very good. Does anyone do something similar and had a great idea?

Thank you!


Solution

  • It is possible to expose documents from non-file sources in VS, but PTVS itself assumes a file system, because it needs to implement Python rules of what constitutes a package and a module, and how to locate them for imports (so it needs to be aware of subdirectories and parent directories, __init__.py files etc). So even if you were to expose a document directly from the database in a VS text editor with Python content type, you'd basically get syntax highlighting and rudimentary code completion, but type inference engine that drives advanced completion in PTVS won't work. So if you want full fledged editing capabilities, you will need to have the code presented in the file system.