Rick Strahl's FoxPro and Web Connection Web Log
White Papers | Products | Message Board | News |

Visual Studio Gets Support for FoxPro Files


Wednesday, November 16, 2016, 2:26:15 PM

Visual Studio 2015 now has support for FoxPro files by way of a very cool add-in from Mads Kristensen. Mads is a a Program Manager on the Visual Studio Tools team and the prime driver behind extensions for ASP.NET tooling and he has created a cool extension that can take existing Textmate style syntax files and render them as syntax highlighted documents. Thanks to Matt Slay who a while back created a Sublime Text FoxPro language extension, Mads was able to add FoxPro as a language to the extension language pack.

End result: You can now view and edit FoxPro files with syntax coloring in Visual Studio natively. Keep in mind this basic syntax coloring support, not a full featured editor with auto-complete. Just the basics...

Here's what this looks like:

You can find out more and install the extension from here:

or use the Visual Studio Extension Manager to add it directly from within Visual Studio.

You'll also want to install the File Icons extension to show appropriate icons for your FoxPro files:

Cool!

It's nice to have native support for FoxPro right in Visual Studio, so you can open and edit FoxPro files right from the Visual Studio project.

This works great when working with Web Connection, so that you can quickly open PRG files and edit them in-place. If you're Web Control Pages and you keep your PRG files with the script page file, the two files live side by side and you can edit them.

It's also useful for checking out generated script template PRG files while debugging code and you can also open Process class files (manually) in the editor and see your process class code side by side with a template.

Keep in mind the features are limited to syntax coloring. There's no auto-complete support, so you may still want to use the Web Connection add-in to explicitly open FoxPro files in the FoxPro editor.

Other Editors with Web Connection?

FWIW, you don't have to use Visual Studio or FoxPro either. If you want a different editor for your PRG files - like Sublime text as I've done for years - you can use the Open With... option to specify a default editor to open files with. You can map PRG files there to whatever editor you like including the VFP IDE.

Once done double clicking opens the file in the specified editor. I've been using Sublime for years because it fires up quickly, but now I may stick with the built in editor simply for the fact that everything is one place.

Web Connection and Editing FoxPro Files

Note Web Connection also supports opening Code behind files using the Web Connection Visual Studio Addin:

Web Control Pages automatically open the code behind file. For script and template pages a special page directive allows you to specify what file should be opened - notice the highlight in the code file above:

<% * SourceFile="~/../../fox/samples/wwdemo/wwdemo.prg" %>

which lets you specify what file is opened. Here it points at the Web Connection wwProcess class handler file as a relative path to the current document.

The editor that's used can be configured in web.config using the following settings:

<configuration>
    <webConnectionVisualStudio>
        <add key="FoxProEditor" value="" />
        <add key="FoxProEditorAlternate" value="C:\Program Files\Sublime Text 3\sublime_text.exe" />
    </webConnectionVisualStudio>
</configuration>  

An empty string value means that the VFP IDE is used, otherwise the file specified by the path is used with the filename passed as parameter.

Any way you slice it - there are now quite a few options for opening FoxPro code in a decent editor - you get to choose what works best for you.

Posted in: Web Connection    FoxPro    Visual Studio

Feedback for this Weblog Entry

 

re: Visual Studio Gets Support for FoxPro Files
Nov. 24, 2016 1:41am| by Cetin Basoz

I downloaded and installed the extension in an excitement (besides VFP, I have been using C# and Go and seeing Go there made me more happy initially).
However it is a total disappointment. It doesn't even work as well as VFP's own editor.

Come on Microsoft you could do it better for your own product! Notepad++ is doing that highlighting for years (not surprising after the failure they made announcement "VS on Mac" has turned to be another big disappointment with their ridicilous license aggrement).

re: Visual Studio Gets Support for FoxPro Files
Nov. 24, 2016 3:21am| by Rick Strahl

Cetin - this is actually not an official Microsoft language add-in. Mads just built this on his own and FoxPro merely uses the TextMate add in to provide FoxPro support. The individual languages are not supported by this add-in but rather they are re-using existing Textmate add-ins from other tools (in this case Matt Slay's Sublime implementation). That implementation only provides highlighting not auto-complete features.

TextMate syntax supports better autocomplete, but the language file has to be built up to support this. The source code for the plug-in is available so you can contribute to make it better yourself instead of crying about it. Guaranteed nobody at Microsoft is going to do it for us...

re: Visual Studio Gets Support for FoxPro Files
Nov. 29, 2016 11:35am| by Richard Kaye

The link for the syntax highlighting extension has some extraneous text at the beginning of the URL, Rick.
 



© Rick Strahl, West Wind Technologies, 2004 - 2017