阻止Visual Studio 2010中的注释格式

时间:2011-05-30 03:28:40

标签: visual-studio visual-studio-2010

我正在使用API​​中的内联文档,在评论中使用XML,我想保留缩进。每次格式化文档(CTRL + K CTRL + D)时,都会删除/ * * /中的所有缩进。有没有办法防止这种情况发生?如果我使用单行注释,看起来我可以保持缩进,但我宁愿不诉诸于此。谢谢你的时间。

/*
<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>
*/

应该是

/*
<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>
*/

1 个答案:

答案 0 :(得分:1)

在安装了Productivity Power Tools的Visual Studio 2010中(Microsoft的免费扩展,必备)此问题不存在 - 当文件通过 Ctrl + K D