SA Developer .NET

Visual Studio Text Editor for Python

rated by 0 users
This post has 8 Replies | 1 Follower

Top 10 Contributor
Male
Posts 236
Fengol Posted: Fri, Mar 30 2007 12:36

I'm writing a lot of IronPython at the moment and I have a lot of Python scripts in my project.

I seem to remember you can update the Visual Studio text editor to recognise new file extensions and write a XLST (or something) to give you keyword highlighting in the editor for your new language.

Does anyone know how to do this or where I can get more information?  Google searches are bringing up things I can buy but not how to extend Visual Studios yourself 

Top 50 Contributor
Male
Posts 52

Depending on your requirements (and the amount of work you want to put into it) you could write your own language service and register it in VS. This is done using the Visual Studio SDK, it's a bit involved but (luckily) the MSDN sample provides a partially complete IronPython sample. You can get your hands on the sample at http://msdn2.microsoft.com/en-us/library/bb165099(VS.80).aspx

Alternatively, you could also try this (I have VS.NET 2005 so the folders/keys reflect this; modify to your install folders etc.):

1. Create a file called usertype.dat in the C:\Program Files\Microsoft Visual Studio 8\Common7\IDE folder
2. Add the new keywords, each on its own line in the dat file
3. Create a new registry key for the extension:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\File Extensions\.py]

4. Set the new registry key's (default) value to {8B382828-6202-11d1-8870-0000F87579D2}
5. If VS is open, restart
6. Load your python files

Hope this helps

Top 10 Contributor
Male
Posts 834
Leads
I am assuming you've already looked at IronPython CTP. I happen to come across it accidentally this weekend and not sure if it is what your looking for.

The views, comments and opinions expressed in this post is that of the poster alone unless otherwise indicated. 

Diago.co.za

Top 10 Contributor
Male
Posts 236

No, I haven't looked at IronPython for ASP.NET (although I'm intrigued) and while I'm using the IronPython engine in one of my applications what I really want to do is write Python code using Visual Studio as supposed to using something like PyScripter and then copy-pasting the code into Visual Studio.  I want right-click on my project and click Add -> New Item and select Python file and have keyword sensitivity while I write.

Thanks JacoE, let me check it out.  As it stands I have an XSLT with all the Python keywords and stuff so it shouldn't be too hard to convert 

 

Top 10 Contributor
Male
Posts 236
Fengol replied on Tue, Apr 24 2007 14:25
OK, the end result is that I built my own Python Script editor (using DevExpress for a ribbon/menu system; and ICSharp.TextEditor)
Top 10 Contributor
Male
Posts 834
Leads
Diago replied on Tue, Apr 24 2007 14:29

Fengol:
OK, the end result is that I built my own Python Script editor (using DevExpress for a ribbon/menu system; and ICSharp.TextEditor)

And this open source software is available for download at..... Wink

The views, comments and opinions expressed in this post is that of the poster alone unless otherwise indicated. 

Diago.co.za

Top 10 Contributor
Male
Posts 236

Unfortunately the editor I wrote is propritory to the project I wrote and my DevExpress toolbox license is owned by my company.  When I become bored of my Xbox 360 I'll sit at home an re-write it for open source.

Top 10 Contributor
Male
Posts 540
Moderator
How about a precise on the functions and constraints of the editor, and maybe some other budding Python enthusiast may start work on an open source version.  I still remember fondly the COBOL editor I whipped out in Turbo Pascal in order to allow me and my cute little class mate to knock out our assignment in a single afternoon without the school's Microfocus COBOL editor. 
Top 10 Contributor
Male
Posts 236
One word, breakpoints! It's a pain to do in a visual manner, especially if you want to give that Microsoftie look-and-feel.  Unfortunately I'm under NDA about what I have in my current editor but when I get something out (this weekend, 29th April 2007) you'll see what I'm playing with.
Page 1 of 1 (9 items) | RSS