Francesco Geri

Il blog di Francesco Geri
posts - 94, comments - 165, trackbacks - 2

Personalizzare il template dei commenti in Visual Studio (per VB.NET)

Come tutti sanno in Visual Studio 2005 si può creare la documentazione automatica del proprio codice semplicemente scrivendo i commenti con il triplice apice (''').

Di default, se si scrivono i tre apici davanti ad un metodo o a quello che volete, automaticamente Visual Studio completa con qualcosa del tipo:

   1: ''' <summary>
   2: ''' 
   3: ''' </summary>
   4: ''' <remarks></remarks>

Io non faccio molto uso di del tag remarks, per cui mi da un po' noia il fatto che ci sia.

Beh, ovviamente, si può personalizzare il template dei commenti e decidere, ad esempio, di non autogenerae il tag remarks o qualunque altra cosa.

Per otterene la personalizzazione bisogna individuare la cartella \Documents and Settings\<user-name>\Application Data\Microsoft\VisualStudio\8.0 (o l'analoga in Vista \Users\<user-name>\AppData\Roaming\Microsoft\VisualStudio\8.0), creare un file di nome VBXMLDoc.xml con il template che desiderate.

Quello di default, che quindi ciascuno può modificare a piacere, è il seguente:

 

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <XMLDocCommentSchema>
   3:  
   4:     <CodeElement type="Module">
   5:         <Template>
   6:             <summary/>
   7:             <remarks/>
   8:         </Template>
   9:         <CompletionList>
  10:             <include file="" path=""/>
  11:             <permission cref=""/>
  12:             <remarks/>
  13:             <summary/>
  14:         </CompletionList>
  15:     </CodeElement>
  16:    
  17:     <CodeElement type="Class">
  18:         <Template>
  19:             <summary/>
  20:             <remarks/>
  21:         </Template>
  22:         <CompletionList>
  23:             <include file="" path=""/>
  24:             <permission cref=""/>
  25:             <remarks/>
  26:             <summary/>
  27:         </CompletionList>
  28:     </CodeElement>
  29:  
  30:     <CodeElement type="Structure">
  31:         <Template>
  32:             <summary/>
  33:             <remarks/>
  34:         </Template>
  35:         <CompletionList>
  36:             <include file="" path=""/>
  37:             <permission cref=""/>
  38:             <remarks/>
  39:             <summary/>
  40:         </CompletionList>
  41:     </CodeElement>
  42:    
  43:     <CodeElement type="Interface">
  44:         <Template>
  45:             <summary/>
  46:             <remarks/>
  47:         </Template>
  48:         <CompletionList>
  49:             <include file="" path=""/>
  50:             <permission cref=""/>
  51:             <remarks/>
  52:             <summary/>
  53:         </CompletionList>
  54:     </CodeElement>
  55:    
  56:     <CodeElement type="Enum">
  57:         <Template>
  58:             <summary/>
  59:             <remarks/>
  60:         </Template>
  61:         <CompletionList>
  62:             <include file="" path=""/>
  63:             <permission cref=""/>
  64:             <remarks/>
  65:             <summary/>
  66:         </CompletionList>
  67:     </CodeElement>
  68:    
  69:     <CodeElement type="Property">
  70:         <Template>
  71:             <summary/>
  72:             <param/>
  73:             <value/>
  74:             <remarks/>
  75:         </Template>
  76:         <CompletionList>
  77:             <exception cref=""/>
  78:             <include file="" path=""/>
  79:             <param name=""/>
  80:             <permission cref=""/>
  81:             <remarks/>
  82:             <summary/>
  83:             <value/>
  84:          </CompletionList>
  85:     </CodeElement>
  86:    
  87:     <CodeElement type="Sub">
  88:         <Template>
  89:             <summary/>
  90:             <param/>
  91:             <remarks/>
  92:         </Template>
  93:         <CompletionList>
  94:             <exception cref=""/>
  95:             <include file="" path=""/>
  96:             <param name=""/>
  97:             <permission cref=""/>
  98:             <remarks/>
  99:             <summary/>
 100:         </CompletionList>
 101:     </CodeElement>
 102:    
 103:     <CodeElement type="Function">
 104:         <Template>
 105:             <summary/>
 106:             <param/>
 107:             <returns/>
 108:         </Template>
 109:         <CompletionList>
 110:             <exception cref=""/>
 111:             <include file="" path=""/>
 112:             <param name=""/>
 113:             <permission cref=""/>
 114:             <remarks/>
 115:             <returns/>
 116:             <summary/>
 117:         </CompletionList>
 118:     </CodeElement>
 119:    
 120:     <CodeElement type="Operator">
 121:         <Template>
 122:             <summary/>
 123:             <param/>
 124:             <returns/>
 125:             <remarks/>
 126:         </Template>
 127:         <CompletionList>
 128:             <exception cref=""/>
 129:             <include file="" path=""/>
 130:             <param name=""/>
 131:             <permission cref=""/>
 132:             <remarks/>
 133:             <returns/>
 134:             <summary/>
 135:         </CompletionList>
 136:     </CodeElement>
 137:    
 138:     <CodeElement type="Declare">
 139:         <Template>
 140:             <summary/>
 141:             <param/>
 142:             <returns/>
 143:             <remarks/>
 144:         </Template>
 145:         <CompletionList>
 146:             <exception cref=""/>
 147:             <include file="" path=""/>
 148:             <param name=""/>
 149:             <permission cref=""/>
 150:             <remarks/>
 151:             <returns/>
 152:             <summary/>
 153:         </CompletionList>
 154:     </CodeElement>
 155:    
 156:     <CodeElement type="Field">
 157:         <Template>
 158:             <summary/>
 159:             <remarks/>
 160:         </Template>
 161:         <CompletionList>
 162:             <include file="" path=""/>
 163:             <permission cref=""/>
 164:             <remarks/>
 165:             <summary/>
 166:         </CompletionList>
 167:     </CodeElement>
 168:    
 169:     <CodeElement type="Delegate">
 170:         <Template>
 171:             <summary/>
 172:             <param/>
 173:             <returns/>
 174:             <remarks/>
 175:         </Template>
 176:         <CompletionList>
 177:             <include file="" path=""/>
 178:             <param name=""/>
 179:             <permission cref=""/>
 180:             <remarks/>
 181:             <returns/>
 182:             <summary/>
 183:         </CompletionList>
 184:     </CodeElement>
 185:    
 186:     <CodeElement type="Event">
 187:         <Template>
 188:             <summary/>
 189:             <param/>
 190:             <remarks/>
 191:         </Template>
 192:         <CompletionList>
 193:             <include file="" path=""/>
 194:             <param name=""/>
 195:             <permission cref=""/>
 196:             <remarks/>
 197:             <summary/>
 198:         </CompletionList>
 199:     </CodeElement>
 200:    
 201:     <ChildCompletionList>
 202:         <c/>
 203:         <code/>
 204:         <example/>
 205:         <list type="">
 206:             <listheader>
 207:                 <term/>
 208:                 <description/>
 209:             </listheader>
 210:         </list>
 211:         <para/>
 212:         <paramref name=""/>
 213:         <see cref=""/>
 214:         <seealso cref=""/>
 215:     </ChildCompletionList>
 216:    
 217: </XMLDocCommentSchema>

 

[Vedi fonte]

Print | posted on domenica 19 ottobre 2008 22:04 | Filed Under [ VS2005 .Net ]

Powered by:
Powered By Subtext Powered By ASP.NET