Shader Intellisense / Code completion

Hey all,

I use Visual Studio for all my C# scripting, and comfortable as I am, I’ve grown totally accustomed to the luxury of its intellisense support telling me exactly what’s available and what exactly is in scope at any given time, as well as its code-completion. But I recently started studying shader programming, and Visual Studio has no idea what a .shader-file is, so it has no syntax highlighting - it’s not even indenting lines after a “{”. So now I’m back to playing “Where’s Waldo” with compile-time errors whenever I slightly mistyped a variable name again. It’s really a “back to the stone age”-experience. I miss having someone hold my hand, damn it! :stuck_out_tongue:

Is anyone aware of a way to get intellisense support for Cg in Visual Studio? Or if that’s not possible, perhaps another editor I can run on the side? I just need something that knows what’s up and down in Cg as I type. For instance, I’d like to know exactly what is in unitycg.cginc. I understand it defines things like input structs and provides access to stuff like the ModelViewProjection-matrix, but I’d like to see its complete contents. It doesn’t seem very well documented.

I searched around and found the Strumpy editor, but that isn’t what I’m looking for. I understand shader-code just fine, so a visual drag’n’drop editor that hides it from me is not the goal.

Since no one else seems to have an answer for this one, I’m going to go ahead and link to this website:

http://unityvs.com/roadmap/

This is a plugin for Unity/Visual Studio which attached Unity’s process to Visual Studio’s debugger, so you can debug your Unity app in Visual Studio. I think it looks extremely promising. But the part that’s related to this question is the topic on the roadmap page I linked to - it says they’re going to implement code completion and code coloration for shaders, effectively offering precisely what I asked for in this question.

So, for those of you who write ShaderLab/Cg code and are in dire need of a proper editor for it like myself, look out for this feature. I think I’ve convinced my boss to purchase a license for us. :wink:

I’m looking forward to this! Has there ever been a code completion solution for shader languages?

In the interim, at least you can do this: http://forum.unity3d.com/threads/108995-Tutorial-How-to-use-NShader-with-Unity-shaders