5
我正在做一个API的内联文档,在注释中使用XML,并且我想保留缩进。每次文档格式化(CTRL + K CTRL + D)时,/ * * /中的所有缩进都将被删除。有没有选择来防止这种情况发生?它看起来像我可以保留缩进,如果我使用单行注释,但我宁愿不诉诸于此。谢谢你的时间。防止在Visual Studio 2010中的注释格式
/*
<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>
*/
我无法重现此行为。 – Dave 2011-05-30 03:49:25
@Dave您正在将第二个代码块粘贴到VS2010中;格式化文档;你不会失去缩进?那会让我希望这是可能的。 – Brett 2011-05-30 04:12:44
是的,我把你的第二个(格式化的)代码块粘贴到我的编辑器中,点击CTRL-K,CTRL-D,它重新格式化了页面上的所有代码,但是留下了你的评论。 – Dave 2011-05-30 05:04:36