HTML Editor in Visual Studio 2008: how to break attributes to separate lines? - visual-studio

In Visual Studio 2008, I've used a nice feature in its XAML editor which breaks a line so that a control's attributes are automatically positioned on new lines: one attribute per line.
Is there a way to do the same for the HTML editor?
Thank you.

Oded, thank you very much! You gave me an idea on how to apply "one attribute per line" formatting to an ASP.NET document:
In Visual Studio 2008, right-click on the .aspx file in the Solution Explorer.
Select "Open With..".
Select "XML Editor". [Assuming that the XML Editor has been properly configured in Tools->Options prior to doing this.]
Edit -> Advanced -> Format Document.
This reformats the document so that each attribute is positioned in its own line, and all of them are nicely indented.
Of course, if I later reopen the same file in Web Forms Designer and format it again, it goes back to what it looked like before.
But for my purposes (easily finding the required attributes in a large file), this temporary solution is quite sufficient.
Once again, thank you very much!
Best regards,
Dmitriy

Related

wanna have a designer for a REPX file - VS13/DevExpress

I want to open a repx file with a designer.
(but now, I only see the code behind)
I have installed Visual Studio 2013 and DevExpress.
I just want to add 3 paramters to a printer lable.
The existing file was made with XtraReport - maybe that helps.
Thx.
First, open or create a blank XtraReport file in design mode in Visual Studio. Then, click on the Tasks tag on the upper-left corner of the report design surface. From the pop-up menu, click on "Open/Import" and select a .repx file.

Is there a way of extracting a selection into a partial or another view either in VS 2013 Editor or Resharper?

Is there a way of selecting HTML or razor code in the VS Editor and extract it into a separate view file?
Visual Studio 2013 already has a similar feature in WebForms where code selection can be extracted into a UserControl. Also, RubyMine, Resharper's sister product, has a "Extract Partial View" feature that extracts code into a separate view file.
I'd wager that such a feature exists in either product, but I haven't been able to find it. Does it exist?
https://youtrack.jetbrains.com/issue/RSRP-263354
Doesn't look like it will be possible any time soon unfortunately

Can Visual Studio 2010 do ".inc" file syntax highlighting?

Can Visual Studio 2010 be configured to do syntax highlighting on ".inc" files? We have numerous large projects with tons of these ".inc" files (asp files) and so changing the file extension to ".asp" is not an option. All I want Visual Studio 2010 to do is treat these ".inc" files just like ".asp" files when it comes to syntax highlighting.
I've tried "Open With..." and selected the HTML Editor, which is the ".asp" default, but that did not work. I tried about every other editor in the list and none of them worked.
I know Notepad++ (among others) can do this, but I would prefer this be done in Visual Studio 2010 - using another IDE or text editor is not the answer I'm looking for here.
In Visual Studio...go to Options -> Text Editor -> File Extension. Type in 'inc' as extension and editor as 'Web Form Editor'. You may need to close then re-open your currently open .Inc pages...Hope this helps
I found both the 'Web Form Editor' and 'HTML Editor' to be less than ideal for me. Both of them appeared to highlight the syntax of the HTML ok, but the VBScript keywords were left in standard black text along with everything else.
While not ideal, I followed the instructions from the other answers, but substitude Visual Basic as the editor type and that worked much more to my liking (as they were include files, there is little HTML in them).
Options -> Text Editor -> File
Extension. Type in 'inc' as extension and set editor as 'Visual Basic'.
Close and re-open any '.inc' files and highlighting should be visible.
Antonio's solution worked for me. I did have to close and reopen files, but after I re-opened them the highlighting was visible. Thanks!
Options -> Text Editor -> File Extension.
Type in 'inc' as extension and set editor as 'Web Form Editor'.
Close and re-open any '.inc' files and highlighting should be visible.
Incidentally, this also works in Visual Studio 2005.
Use the File Extension, Text Editor, Options Dialog Box.
http://msdn.microsoft.com/en-us/library/4k7w5e5s.aspx
-update-
I see the same behavior :-( Will let you know if I find anything.
As a workaround, could you rename all your .inc files to .asp?
This has the added advantage that if a request is made for the inc file directly (highly unlikely but possible; and assuming you have the incs in the web directory), your code will be exposed unlike .asp where it is processed and rendered.
I really wanted to add a comment, because this is not a direct answer, but apparently you need 50 reputation for that.
I've found that in Visual Studio 2005 (again, in Tools -> Options -> Text Editor -> File Extension), both "Web Form Editor" and "User Control Editor" highlight both the HTML and the VBScript.
Amadiere mentioned that "Web Form Editor" doesn't highlight the VBScript in 2010, but maybe it's worth trying "User Control Editor", if that's an option in 2010.
In Visual Studio 2010 and 2012 Express it best works for me when I use "Microsoft Visual Basic" with my .inc files. Nevertheless, it's still not the same as with .asp files as there's no Autocomplete nor IntelliSense (Ctrl+Space, Ctrl+Shift+Space etc.) with the .inc files.
It should be made possible defining that .inc files are to be treated just as .asp files.
I agree with Purple Coder:
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.
But, first of all in my case this is an intranet page and therefore not very risky, as most people there would somehow find the files on the server anyway. I'm also not sure where this naming convention came from. It was there before I started. This was started on Visual Studio 6.
But, to avoid this risk there's a simple solution: add .inc in the Application Mapping of the IIS in the same manner as .asp.
You should not name the files containing ASP code as .inc. It is a security risk. Anyone who knows/can guess the filename can open it in a browser and view the actual code inside the file.

How do I get triple click to work in Visual Studio's Text Editor

Go into Notepad, Internet Explorer or most other applications that display or edit text. Triple click on some text. Windows will select the entire paragraph under the cursor.
This doesn't work in Visual Studio 2005.
How do I get triple click support in the Visual Studio text editor?
do VS 2008 or VS 2010 solve this?
Is there a macro, setting or plugin that will solve this?
I wrote an extension for this for Visual Studio 2010 that you can download from the VS Gallery or directly from the extension manager in Visual Studio, by searching for "triple click" or my name.
You can also read the blog post I wrote about it and check out the source, on github.
I haven't used it, but CodeProject has an article on SmartHelp 3.04 which mentions that you can triple click to select a whole line.
Also, from Craig Shoemaker's blog.
About VS 2010.
Further enhancements include the
ability to triple-click an expansive
element like a table and the editor
selects the entire table’s markup.
Want to surround that table with some
additional markup? Just start typing
with the table selected and your
markup is inserted around the selected
code.

Automatically adding specified text at beginning of files in VS 2008

Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.
I assume you'd like to modify the class file templates. They're in:
%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
More specific details here
I found a better solution than modifying the template file directly. This utility allows you to create and save header/footer templates and apply them to entire source trees.
C# Header Designer from MSDN Code Gallery

Resources