I do all my programming for the GfxRacer XNA project using Visual Studio 2010. At some point early in the process I bumped into effect (.fx) files.
I half expected VS2010 to have basic support for hlsl/.fx files. I was unpleasantly surprised to find no built in support, and was unable to find any plugins/addons to give even basic syntax highlighting.
I dug around and found I could tell c# that the .fx file is really a "C# type" file, and I get back *decent* syntax highlighting (but not that great).
The main downside though is the errors that are generated at compile time. The build will still compile fine when there are no errors. But as soon as a real error creeps in (in the .fx file or any other files) it's obscured by the dozens of false-errors.
HLSL Editors: The Usual Suspects
Now, I have fxComposer and RenderMonkey, but I find downsides to the huge footprint, and propriatary file formats wrapped around what I really need (just the bare .fx file).
When I'm experimenting they're great though.
Notepad++
I won't go into details, but it's a great, lightweight text editor tool.
Now, natively it doesn't have specific HLSL support. However, it's simple enough to add what Notepad++ calls a UserLanguage, and this can do a rather good job.
HLSL in Notepad++
I downloaded the HLSL UserLanguage from here:
http://www.enchantedage.com/node/97
and added the .xml file contained in the zip to my %appdata%\Notepad++\ folder
And the language will show up in Notepad++ under Languages
Lastly, you'll want to turn on Autocomplete in Notepad++, I'm using the following settings
Settings->Preferences |
Now as you're editing or creating a .fx file, Notepad++ will suggest completions as you type:
That's it for Notepad++, opening a .fx file should now autodetect as a HLSL language format file and give you autocompletion tips as you type!
Back to the IDE
So that's all well and good you're saying, I have a decent HLSL editor, but what about my IDE?
Good question. Fortunately VS2010 knows it can't do the best on everything for you, so it allows you to override the way it opens particular file types.
Just right click a .fx file in your project, select Open With..., add Notepad++ and set it as the default tool to use to open files of this type.
That's it! The last thing I did was set the font in Notepad++ to match what I'm using in my IDE. If you're particular, you can probably find a color scheme to match what you have in VS2010, but I'm not that picky.
Settings->Style Configurator |
nice!
ReplyDeleteThanks for this!