2011-05-30 61 views
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> 
*/ 
+1

我無法重現此行爲。 – Dave 2011-05-30 03:49:25

+0

@Dave您正在將第二個代碼塊粘貼到VS2010中;格式化文檔;你不會失去縮進?那會讓我希望這是可能的。 – Brett 2011-05-30 04:12:44

+1

是的,我把你的第二個(格式化的)代碼塊粘貼到我的編輯器中,點擊CTRL-K,CTRL-D,它重新格式化了頁面上的所有代碼,但是留下了你的評論。 – Dave 2011-05-30 05:04:36

回答

1

在Visual Studio 2010 Productivity Power Tools安裝(免費從微軟的擴展,必須具備的)這個問題不存在 - 格式化註釋中保存文件的時候通過自動格式化Ctrl + KD