Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent comment formatting in Visual Studio 2010

I am doing inline documentation on an API, using XML in comments, and I'd like to keep the indenting. Every time the document is formatted (CTRL+K CTRL+D), all indenting inside /* */ is removed. Is there an option to prevent this from happening? It looks like I can keep the indenting if I use single line commenting, but I'd rather not resort to this. Thanks for your time.

/*
<ObjectProperty Name="id" Type="string" DefaultValue="''">
<Description>
Unique identifier of the data store. Primarily used for getting a handle  <docref class="ObjectManager">ObjectManager</docref>.
</Description>
<Examples>
<Example>
// Create an anonymous DataStore
// Update and Sort the data by using ObjectManager
new DataStore({ id: 'PersonsDS' });
ObjectManager.GetDataStore('PersonsDS').UpdateData([
{
ID: 1,
FirstName: 'Joe',
LastName: 'Bloggs'
},
{
ID: 2,
FirstName: 'Jane',
LastName: 'Doe'
}
]).Sort('LastName', 'desc');
</Example>
</Examples>
</ObjectProperty>
*/

Should look like

/*
<ObjectProperty Name="id" Type="string" DefaultValue="''">
    <Description>
        Unique identifier of the data store. Primarily used for getting a handle  <docref class="ObjectManager">ObjectManager</docref>.
    </Description>
    <Examples>
        <Example>
            // Create an anonymous DataStore
            // Update and Sort the data by using ObjectManager
            new DataStore({ id: 'PersonsDS' });
            ObjectManager.GetDataStore('PersonsDS').UpdateData([
            {
                ID: 1,
                FirstName: 'Joe',
                LastName: 'Bloggs'
            },
            {
                ID: 2,
                FirstName: 'Jane',
                LastName: 'Doe'
            }
            ]).Sort('LastName', 'desc');
        </Example>
    </Examples>
</ObjectProperty>
*/
like image 259
Brett Avatar asked Nov 14 '22 22:11

Brett


1 Answers

In Visual Studio 2010 with Productivity Power Tools installed (free extension from Microsoft, a must-have) this problem does not exist - formatting is preserved in comments when the file is automatically formatted via Ctrl + K, D.

like image 53
skolima Avatar answered Dec 22 '22 08:12

skolima