views:

149

answers:

4

I'm developing Asp.net MVC applications and since there's quite a bit of in-place server scripts in my aspx/ascx files it can become really messy finding your way around.

What I would like to do (to make things easier on me) is set some background colour to server-side scripts.

Right now only <% and %> have yellow background, but I would like the content between these two to also have a certain background colour. Something similar that Tengible's T4 editor does in T4 files with template executable code.

How do I do this if at all possible?

A sidenote
This is not related to Asp.net MVC in particular but to Visual Studio in general. It will benefit Asp.net MVC developers the most though. :)

A: 

I don't know if it is possible, but I recommend opening the Tools / Options dialog, and in there looking around in Environment / Fonts and Colors. There is a "HTML Server-Side Script" item in the list, but I think it is just for the <% and %> tags.

Perhaps you should consider writing a VS Extension for this purpose. (For VS 2010, it is even easier to make one.)

Venemo
I've checked those setting before already and yes they are related to `<%` and `%>` tags only... No setting for content between them...
Robert Koritnik
A: 

You did not specifically say whether you wanted to avoid doing this with third party tools. It might be possible to do this with DevExpress CodeRush! tool. I have not looked into their custom macro support.

GrayWizardx
Legit answer. True. I didn't specifically say I want to achieve this addin-less. Because I think that is not at all possible.
Robert Koritnik
A: 

Go to tool -> Options -> Text Editor -> HTML -> Format -> tag Specific Option -> ASP.NET Controls. In this section it provides all the tags, you can change the tag which you like.

Devi
I'm not able to configure `<% %>` server side script section. I added them manually, but there was no obvious effect in the text editor whatsoever. Have you tried it?
Robert Koritnik
Devi
Exactly what I am talking about here. You can only change the display of the `<%` and `%>` but not for the content between these two.
Robert Koritnik
+1  A: 

Without addins this is impossible. No such setting in Visual Studio 2008 environment (or 2010 for that matter either).

Robert Koritnik