├── .gitattributes ├── .gitignore ├── COPYING ├── CommitFormatter.Core ├── CommitFormatter.Core.csproj ├── FormatterSettings.cs ├── Properties │ └── AssemblyInfo.cs ├── TextFormatter.cs ├── TextHelper.cs └── packages.config ├── CommitFormatter.TeamFoundation.14.0 ├── CommitFormatter.TeamFoundation.14.0.csproj ├── FormatterSection.cs ├── Properties │ └── AssemblyInfo.cs ├── SettingsSection.cs ├── SettingsSectionView.xaml ├── SettingsSectionView.xaml.cs └── TeamExplorerBase │ ├── TeamExplorerBase.cs │ ├── TeamExplorerBaseNavigationItem.cs │ ├── TeamExplorerBaseNavigationLink.cs │ ├── TeamExplorerBasePage.cs │ └── TeamExplorerBaseSection.cs ├── CommitFormatter.TeamFoundation.15.0 ├── CommitFormatter.TeamFoundation.15.0.csproj └── Properties │ └── AssemblyInfo.cs ├── CommitFormatter.Tests ├── CommitFormatter.Tests.csproj ├── Properties │ └── AssemblyInfo.cs ├── TokenizeTests.cs └── WrapTest.cs ├── CommitFormatter.sln ├── CommitFormatter ├── CommitFormatter.csproj ├── CommitFormatterPackage.cs ├── Guids.cs ├── LICENSE.txt ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── CommitFormatterPackage.ico │ ├── commit-message.png │ ├── git-icon.png │ └── settings.png ├── VSPackage.resx ├── packages.config └── source.extension.vsixmanifest ├── README.md └── lib ├── 14.0 ├── Microsoft.TeamFoundation.Client.dll ├── Microsoft.TeamFoundation.Common.dll └── Microsoft.TeamFoundation.Controls.dll └── 15.0 ├── Microsoft.TeamFoundation.Client.dll ├── Microsoft.TeamFoundation.Common.dll └── Microsoft.TeamFoundation.Controls.dll /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # Visual Studio 2015/2017 cache/options directory 20 | .vs/ 21 | 22 | # Roslyn cache directories 23 | *.ide/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | #NUNIT 30 | *.VisualState.xml 31 | TestResult.xml 32 | 33 | # Build Results of an ATL Project 34 | [Dd]ebugPS/ 35 | [Rr]eleasePS/ 36 | dlldata.c 37 | 38 | *_i.c 39 | *_p.c 40 | *_i.h 41 | *.ilk 42 | *.meta 43 | *.obj 44 | *.pch 45 | *.pdb 46 | *.pgc 47 | *.pgd 48 | *.rsp 49 | *.sbr 50 | *.tlb 51 | *.tli 52 | *.tlh 53 | *.tmp 54 | *.tmp_proj 55 | *.log 56 | *.vspscc 57 | *.vssscc 58 | .builds 59 | *.pidb 60 | *.svclog 61 | *.scc 62 | 63 | # Chutzpah Test files 64 | _Chutzpah* 65 | 66 | # Visual C++ cache files 67 | ipch/ 68 | *.aps 69 | *.ncb 70 | *.opensdf 71 | *.sdf 72 | *.cachefile 73 | 74 | # Visual Studio profiler 75 | *.psess 76 | *.vsp 77 | *.vspx 78 | 79 | # TFS 2012 Local Workspace 80 | $tf/ 81 | 82 | # Guidance Automation Toolkit 83 | *.gpState 84 | 85 | # ReSharper is a .NET coding add-in 86 | _ReSharper*/ 87 | *.[Rr]e[Ss]harper 88 | *.DotSettings.user 89 | 90 | # JustCode is a .NET coding addin-in 91 | .JustCode 92 | 93 | # TeamCity is a build add-in 94 | _TeamCity* 95 | 96 | # DotCover is a Code Coverage Tool 97 | *.dotCover 98 | 99 | # NCrunch 100 | _NCrunch_* 101 | .*crunch*.local.xml 102 | 103 | # MightyMoose 104 | *.mm.* 105 | AutoTest.Net/ 106 | 107 | # Web workbench (sass) 108 | .sass-cache/ 109 | 110 | # Installshield output folder 111 | [Ee]xpress/ 112 | 113 | # DocProject is a documentation generator add-in 114 | DocProject/buildhelp/ 115 | DocProject/Help/*.HxT 116 | DocProject/Help/*.HxC 117 | DocProject/Help/*.hhc 118 | DocProject/Help/*.hhk 119 | DocProject/Help/*.hhp 120 | DocProject/Help/Html2 121 | DocProject/Help/html 122 | 123 | # Click-Once directory 124 | publish/ 125 | 126 | # Publish Web Output 127 | *.[Pp]ublish.xml 128 | *.azurePubxml 129 | ## TODO: Comment the next line if you want to checkin your 130 | ## web deploy settings but do note that will include unencrypted 131 | ## passwords 132 | #*.pubxml 133 | 134 | # NuGet Packages Directory 135 | packages/* 136 | ## TODO: If the tool you use requires repositories.config 137 | ## uncomment the next line 138 | #!packages/repositories.config 139 | 140 | # Enable "build/" folder in the NuGet Packages folder since 141 | # NuGet packages use it for MSBuild targets. 142 | # This line needs to be after the ignore of the build folder 143 | # (and the packages folder if the line above has been uncommented) 144 | !packages/build/ 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | sql/ 155 | *.Cache 156 | ClientBin/ 157 | [Ss]tyle[Cc]op.* 158 | ~$* 159 | *~ 160 | *.dbmdl 161 | *.dbproj.schemaview 162 | *.pfx 163 | *.publishsettings 164 | node_modules/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # LightSwitch generated files 190 | GeneratedArtifacts/ 191 | _Pvt_Extensions/ 192 | ModelManifest.xml 193 | 194 | # VSIX signing 195 | sign.bat 196 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /CommitFormatter.Core/CommitFormatter.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F381663E-9AFE-499A-8C16-770AB9C33977} 8 | Library 9 | Properties 10 | Adrup.CommitFormatter.Core 11 | Adrup.CommitFormatter.Core 12 | v4.6.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll 35 | True 36 | 37 | 38 | ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll 39 | True 40 | 41 | 42 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll 43 | True 44 | 45 | 46 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll 47 | True 48 | 49 | 50 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll 51 | True 52 | 53 | 54 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll 55 | True 56 | 57 | 58 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll 59 | True 60 | 61 | 62 | ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll 63 | True 64 | 65 | 66 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 67 | True 68 | 69 | 70 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll 71 | True 72 | 73 | 74 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll 75 | True 76 | 77 | 78 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll 79 | True 80 | 81 | 82 | ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll 83 | True 84 | 85 | 86 | ..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll 87 | True 88 | 89 | 90 | ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll 91 | True 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 119 | -------------------------------------------------------------------------------- /CommitFormatter.Core/FormatterSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using Microsoft.VisualStudio.Settings; 15 | using Microsoft.VisualStudio.Shell.Settings; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace Adrup.CommitFormatter.Core 23 | { 24 | public class FormatterSettings 25 | { 26 | public const string CollectionPath = "Adrup.CommitFormatter"; 27 | public const string SubjectWidthKey = "SubjectWidth"; 28 | public const string BodyWidthKey = "BodyWidth"; 29 | public const string FontSizeKey = "FontSize"; 30 | public const string UseMonospacedFontKey = "UseMonospacedFont"; 31 | public const string BlankSecondLineKey = "BlankSecondLine"; 32 | public const string EnableSpellCheckKey = "EnableSpellCheck"; 33 | 34 | private WritableSettingsStore _userSettingsStore; 35 | 36 | public FormatterSettings(IServiceProvider serviceProvider) 37 | { 38 | SettingsManager settingsManager = new ShellSettingsManager(serviceProvider); 39 | _userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); 40 | if (_userSettingsStore != null && !_userSettingsStore.CollectionExists(CollectionPath)) 41 | { 42 | _userSettingsStore.CreateCollection(CollectionPath); 43 | SubjectWidth = 50; 44 | BodyWidth = 72; 45 | FontSize = 11; 46 | UseMonospacedFont = true; 47 | BlankSecondLine = true; 48 | } 49 | } 50 | 51 | public int SubjectWidth 52 | { 53 | get { return _userSettingsStore.GetInt32(CollectionPath, SubjectWidthKey); } 54 | set { _userSettingsStore.SetInt32(CollectionPath, SubjectWidthKey, value); } 55 | } 56 | 57 | public int BodyWidth 58 | { 59 | get { return _userSettingsStore.GetInt32(CollectionPath, BodyWidthKey); } 60 | set { _userSettingsStore.SetInt32(CollectionPath, BodyWidthKey, value); } 61 | } 62 | 63 | public int FontSize 64 | { 65 | get { return _userSettingsStore.GetInt32(CollectionPath, FontSizeKey); } 66 | set { _userSettingsStore.SetInt32(CollectionPath, FontSizeKey, value); } 67 | } 68 | 69 | public bool UseMonospacedFont 70 | { 71 | get { return _userSettingsStore.GetBoolean(CollectionPath, UseMonospacedFontKey, true); } 72 | set { _userSettingsStore.SetBoolean(CollectionPath, UseMonospacedFontKey, value); } 73 | } 74 | 75 | public bool BlankSecondLine 76 | { 77 | get { return _userSettingsStore.GetBoolean(CollectionPath, BlankSecondLineKey, true); } 78 | set { _userSettingsStore.SetBoolean(CollectionPath, BlankSecondLineKey, value); } 79 | } 80 | 81 | public bool EnableSpellCheck 82 | { 83 | get { return _userSettingsStore.GetBoolean(CollectionPath, EnableSpellCheckKey, true); } 84 | set { _userSettingsStore.SetBoolean(CollectionPath, EnableSpellCheckKey, value); } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /CommitFormatter.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommitFormatter.Core")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommitFormatter.Core")] 13 | [assembly: AssemblyCopyright("Copyright © 2015-2017 Kristian Adrup")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f381663e-9afe-499a-8c16-770ab9c33977")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CommitFormatter.Core/TextFormatter.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | using System.Text; 18 | using System.Threading.Tasks; 19 | 20 | namespace Adrup.CommitFormatter.Core 21 | { 22 | public class TextFormatter 23 | { 24 | private int _subjectWidth; 25 | private int _bodyWidth; 26 | private bool _blankSecondLine; 27 | 28 | public TextFormatter(int subjectWidth, int bodyWidth, bool blankSecondLine) 29 | { 30 | _subjectWidth = subjectWidth; 31 | _bodyWidth = bodyWidth; 32 | _blankSecondLine = blankSecondLine; 33 | } 34 | 35 | public string Wrap(string text, int caretIndex, out int caretIndexDelta) 36 | { 37 | caretIndexDelta = 0; 38 | int tokenizeIndexDelta = 0; 39 | var sb = new StringBuilder(); 40 | var chars = text.ToCharArray(); 41 | int currentIndex = 0; 42 | int currentLineNum = 1; 43 | 44 | var tokens = new Queue(TextHelper.Tokenize(text, caretIndex, out tokenizeIndexDelta)); 45 | caretIndexDelta += tokenizeIndexDelta; 46 | 47 | int currentWidth = 0; 48 | while (tokens.Count > 0) 49 | { 50 | string token = tokens.Dequeue(); 51 | 52 | if (token == "\r" || token == "\n") 53 | { 54 | currentWidth = 0; 55 | sb.Append(token); 56 | currentIndex += token.Length; 57 | if (token == "\n") currentLineNum++; 58 | } 59 | else 60 | { 61 | if (_blankSecondLine && currentWidth == 0 && currentLineNum == 2) 62 | { 63 | AddVirtualNewline(sb, caretIndex, ref currentIndex, ref currentLineNum, ref caretIndexDelta, ref currentWidth); 64 | } 65 | if (currentWidth > 0 && currentWidth + token.Length > GetLineMaxWidth(currentLineNum)) 66 | { 67 | AddVirtualNewline(sb, caretIndex, ref currentIndex, ref currentLineNum, ref caretIndexDelta, ref currentWidth); 68 | } 69 | else if (currentWidth > 0 && token != " " && tokens.Count > 0 && tokens.Peek() == " " 70 | && currentWidth + token.Length == GetLineMaxWidth(currentLineNum)) // if last char of row is a space we break before the last word so next line won't begin with a space 71 | { 72 | AddVirtualNewline(sb, caretIndex, ref currentIndex, ref currentLineNum, ref caretIndexDelta, ref currentWidth); 73 | } 74 | 75 | currentWidth += token.Length; 76 | sb.Append(token); 77 | currentIndex += token.Length; 78 | } 79 | } 80 | 81 | return sb.ToString(); 82 | } 83 | 84 | private void AddVirtualNewline(StringBuilder sb, int caretIndex, ref int currentIndex, ref int currentLineNum, ref int caretIndexDelta, ref int currentWidth) 85 | { 86 | sb.Append('\n'); 87 | if (currentIndex <= caretIndex + caretIndexDelta) caretIndexDelta++; 88 | currentIndex++; 89 | currentWidth = 0; 90 | currentLineNum++; 91 | 92 | if (_blankSecondLine && currentWidth == 0 && currentLineNum == 2) 93 | { 94 | AddVirtualNewline(sb, caretIndex, ref currentIndex, ref currentLineNum, ref caretIndexDelta, ref currentWidth); 95 | } 96 | } 97 | 98 | private int GetLineMaxWidth(int lineNum) 99 | { 100 | switch (lineNum) 101 | { 102 | case 1: return _subjectWidth; 103 | case 2: return _blankSecondLine ? 0 : _bodyWidth; 104 | default: return _bodyWidth; 105 | } 106 | } 107 | 108 | public int CountLineCharsLeft(string text, int caretIndex) 109 | { 110 | var chars = text.ToCharArray(); 111 | int rowStartIndex = 0; 112 | int currentLineNum = 1; 113 | bool isStartSet = false; 114 | 115 | for (var i = caretIndex; i > 0; i--) 116 | { 117 | if (chars[i - 1] == '\r' || chars[i - 1] == '\n') 118 | { 119 | if (!isStartSet) 120 | { 121 | rowStartIndex = i; 122 | isStartSet = true; 123 | } 124 | if (chars[i - 1] == '\n') currentLineNum++; 125 | } 126 | } 127 | 128 | int rowEndIndex = caretIndex; 129 | while (rowEndIndex < chars.Length) 130 | { 131 | if (chars[rowEndIndex] == '\r' || chars[rowEndIndex] == '\n') 132 | { 133 | break; 134 | } 135 | rowEndIndex++; 136 | } 137 | 138 | int charsLeft = GetLineMaxWidth(currentLineNum) - (rowEndIndex - rowStartIndex); 139 | 140 | return charsLeft; 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /CommitFormatter.Core/TextHelper.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | using System.Text; 18 | using System.Threading.Tasks; 19 | 20 | namespace Adrup.CommitFormatter.Core 21 | { 22 | public static class TextHelper 23 | { 24 | public static int CountLineCharsLeft(string text, int caretIndex, int subjectWidth, int bodyWidth, bool blankSecondLine) 25 | { 26 | var formatter = new TextFormatter(subjectWidth, bodyWidth, blankSecondLine); 27 | return formatter.CountLineCharsLeft(text, caretIndex); 28 | } 29 | 30 | public static string Wrap(string text, int caretIndex, int subjectWidth, int bodyWidth, bool blankSecondLine, out int caretIndexDelta) 31 | { 32 | var formatter = new TextFormatter(subjectWidth, bodyWidth, blankSecondLine); 33 | return formatter.Wrap(text, caretIndex, out caretIndexDelta); 34 | } 35 | 36 | public static string[] Tokenize(string text, int caretIndex, out int caretIndexDelta) 37 | { 38 | caretIndexDelta = 0; 39 | var tokens = new List(); 40 | var chars = text.ToCharArray(); 41 | int latestWordBoundaryIndex = 0; 42 | 43 | bool inWhitespace = false; 44 | 45 | for (int i = 0; i < chars.Length; i++) 46 | { 47 | if (i == chars.Length - 1) // end of text 48 | { 49 | if (char.IsWhiteSpace(chars[i])) 50 | { 51 | if (!inWhitespace) 52 | { 53 | var sb = new StringBuilder(); 54 | sb.Append(chars, latestWordBoundaryIndex, i - latestWordBoundaryIndex); 55 | sb.Replace("\n", ""); 56 | if (sb.Length > 0) 57 | tokens.Add(sb.ToString()); 58 | } 59 | 60 | if (chars[i] == '\n' && (i == 0 || chars[i - 1] != '\r')) 61 | { 62 | if (i < caretIndex) caretIndexDelta--; // If linebreak is removed before caret - move back caret 63 | continue; // Don't add virtual linebreaks that the plugin has set 64 | } 65 | else 66 | { 67 | tokens.Add(chars[i].ToString()); 68 | inWhitespace = true; 69 | } 70 | } 71 | else // ends on non whitespace 72 | { 73 | if (inWhitespace) latestWordBoundaryIndex = i; 74 | var sb = new StringBuilder(); 75 | sb.Append(chars, latestWordBoundaryIndex, i - latestWordBoundaryIndex + 1); 76 | sb.Replace("\n", ""); 77 | if (sb.Length > 0) 78 | tokens.Add(sb.ToString()); 79 | } 80 | 81 | } 82 | else if (chars[i] == '\n' && (i == 0 || chars[i - 1] != '\r')) 83 | { 84 | if (i < caretIndex) caretIndexDelta--; // If linebreak is removed before caret - move back caret 85 | continue; // Don't add virtual linebreaks that the plugin has set 86 | } 87 | else if (char.IsWhiteSpace(chars[i])) 88 | { 89 | if (!inWhitespace && latestWordBoundaryIndex != i) 90 | { 91 | var sb = new StringBuilder(); 92 | sb.Append(chars, latestWordBoundaryIndex, i - latestWordBoundaryIndex); 93 | sb.Replace("\n", ""); 94 | if (sb.Length > 0) 95 | tokens.Add(sb.ToString()); 96 | } 97 | tokens.Add(chars[i].ToString()); 98 | inWhitespace = true; 99 | } 100 | else 101 | { 102 | if (inWhitespace) latestWordBoundaryIndex = i; 103 | inWhitespace = false; 104 | } 105 | } 106 | 107 | return tokens.ToArray(); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /CommitFormatter.Core/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/CommitFormatter.TeamFoundation.14.0.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B} 8 | Library 9 | Properties 10 | Adrup.CommitFormatter.TeamFoundation 11 | Adrup.CommitFormatter.TeamFoundation.14.0 12 | v4.6.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | False 35 | ..\lib\14.0\Microsoft.TeamFoundation.Client.dll 36 | False 37 | 38 | 39 | False 40 | ..\lib\14.0\Microsoft.TeamFoundation.Common.dll 41 | False 42 | 43 | 44 | False 45 | ..\lib\14.0\Microsoft.TeamFoundation.Controls.dll 46 | False 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | SettingsSectionView.xaml 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | MSBuild:Compile 79 | Designer 80 | 81 | 82 | 83 | 84 | {f381663e-9afe-499a-8c16-770ab9c33977} 85 | CommitFormatter.Core 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/FormatterSection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using Adrup.CommitFormatter.Core; 15 | using Microsoft.TeamExplorerSample; 16 | using Microsoft.TeamFoundation.Controls; 17 | using Microsoft.TeamFoundation.Controls.WPF; 18 | using Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework; 19 | using System; 20 | using System.Collections.Generic; 21 | using System.ComponentModel; 22 | using System.Globalization; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Threading.Tasks; 26 | using System.Windows; 27 | using System.Windows.Controls; 28 | using System.Windows.Documents; 29 | using System.Windows.Media; 30 | 31 | namespace Adrup.CommitFormatter.TeamFoundation 32 | { 33 | [TeamExplorerSection(FormatterSection.SectionId, TeamExplorerPageIds.GitChanges, 900)] 34 | public class FormatterSection : TeamExplorerBaseSection 35 | { 36 | public const string SectionId = "18af7740-585c-4410-8d77-500f70061f6e"; 37 | 38 | private int _subjectWidth; 39 | private int _bodyWidth; 40 | private int _fontSize; 41 | private bool _useMonospacedFont; 42 | private bool _blankSecondLine; 43 | private bool _enableSpellCheck; 44 | 45 | private TextBox _commitMessageBox = null; 46 | private LabeledTextBox _labeledTextBox = null; 47 | private bool _isCurrentlyChangingText = false; 48 | private CharsLeftAdorner _adorner; 49 | 50 | public FormatterSection() : base() 51 | { 52 | IsVisible = false; 53 | } 54 | 55 | public override void Initialize(object sender, SectionInitializeEventArgs e) 56 | { 57 | base.Initialize(sender, e); 58 | 59 | var settings = new FormatterSettings(ServiceProvider); 60 | _subjectWidth = settings.SubjectWidth; 61 | _bodyWidth = settings.BodyWidth; 62 | _fontSize = settings.FontSize; 63 | _useMonospacedFont = settings.UseMonospacedFont; 64 | _blankSecondLine = settings.BlankSecondLine; 65 | _enableSpellCheck = settings.EnableSpellCheck; 66 | } 67 | 68 | public override void Loaded(object sender, SectionLoadedEventArgs e) 69 | { 70 | var service = GetService(); 71 | if (service == null) 72 | { 73 | ShowNotification("Commit Formatter: Can't get TeamExplorerViewModel", NotificationType.Error); 74 | return; 75 | } 76 | 77 | var changesGuid = Guid.Parse(TeamExplorerPageIds.GitChanges); 78 | 79 | var pages = new List(); 80 | if (service.CurrentPage != null) 81 | pages.Add(service.CurrentPage); 82 | pages.AddRange(service.UndockedPages); 83 | 84 | var changesPage = pages.FirstOrDefault(p => p.GetId() == changesGuid); 85 | if (changesPage == null) 86 | { 87 | ShowNotification("Commit Formatter: Can't get the Changes page", NotificationType.Error); 88 | return; 89 | } 90 | 91 | var view = changesPage.PageContent as UserControl; 92 | if (view == null) 93 | { 94 | ShowNotification("Commit Formatter: Can't get the Changes view", NotificationType.Error); 95 | return; 96 | } 97 | 98 | _labeledTextBox = view.FindName("commentTextBox") as LabeledTextBox; 99 | if (_labeledTextBox == null) 100 | { 101 | ShowNotification("Commit Formatter: Can't find commentTextBox", NotificationType.Error); 102 | return; 103 | } 104 | 105 | _commitMessageBox = _labeledTextBox.FindName("textBox") as TextBox; 106 | if (_commitMessageBox == null) 107 | { 108 | ShowNotification("Commit Formatter: Can't find textBox", NotificationType.Error); 109 | return; 110 | } 111 | 112 | _commitMessageBox.TextChanged += OnCommitMessageChanged; 113 | _commitMessageBox.SelectionChanged += OnSelectionChanged; 114 | _commitMessageBox.SpellCheck.IsEnabled = _enableSpellCheck; 115 | 116 | if (_useMonospacedFont) 117 | _commitMessageBox.FontFamily = new FontFamily("Consolas"); 118 | _commitMessageBox.FontSize = _fontSize; 119 | _commitMessageBox.TextWrapping = TextWrapping.NoWrap; 120 | } 121 | 122 | private bool InitializeAdorner() 123 | { 124 | if (_adorner == null) 125 | { 126 | var myAdornerLayer = AdornerLayer.GetAdornerLayer(_labeledTextBox); 127 | if (myAdornerLayer == null) return false; 128 | 129 | _adorner = new CharsLeftAdorner(_labeledTextBox); 130 | myAdornerLayer.Add(_adorner); 131 | } 132 | 133 | return true; 134 | } 135 | 136 | void OnSelectionChanged(object sender, RoutedEventArgs e) 137 | { 138 | if (InitializeAdorner()) 139 | { 140 | int charsLeft = TextHelper.CountLineCharsLeft(_commitMessageBox.Text, _commitMessageBox.CaretIndex, _subjectWidth, _bodyWidth, _blankSecondLine); 141 | _adorner.DataContext = charsLeft; 142 | _adorner.InvalidateVisual(); 143 | } 144 | } 145 | 146 | private void OnCommitMessageChanged(object sender, TextChangedEventArgs e) 147 | { 148 | if (_isCurrentlyChangingText) return; 149 | var text = _commitMessageBox.Text; 150 | int caretIndexDelta = 0; 151 | int caretIndex = _commitMessageBox.CaretIndex; 152 | 153 | string newtext = TextHelper.Wrap(text, caretIndex, _subjectWidth, _bodyWidth, _blankSecondLine, out caretIndexDelta); 154 | if (newtext != _commitMessageBox.Text) 155 | { 156 | _isCurrentlyChangingText = true; 157 | _commitMessageBox.Text = newtext; 158 | 159 | _commitMessageBox.CaretIndex = caretIndex + caretIndexDelta; 160 | _isCurrentlyChangingText = false; 161 | } 162 | } 163 | 164 | public override void Dispose() 165 | { 166 | base.Dispose(); 167 | 168 | if (_commitMessageBox != null) 169 | { 170 | _commitMessageBox.TextChanged -= OnCommitMessageChanged; 171 | _commitMessageBox.SelectionChanged -= OnSelectionChanged; 172 | } 173 | } 174 | 175 | } 176 | 177 | public class CharsLeftAdorner : Adorner 178 | { 179 | public CharsLeftAdorner(UIElement adornedElement) 180 | : base(adornedElement) 181 | { 182 | } 183 | 184 | protected override void OnRender(DrawingContext drawingContext) 185 | { 186 | Rect adornedElementRect = new Rect(this.AdornedElement.RenderSize); 187 | 188 | int charsLeft = 0; 189 | int.TryParse(DataContext.ToString(), out charsLeft); 190 | 191 | SolidColorBrush renderBrush = new SolidColorBrush(charsLeft < 0 ? Colors.Red : Colors.Green); 192 | renderBrush.Opacity = 0.6; 193 | 194 | var typeface = new Typeface("Consolas"); 195 | 196 | var formattedText = new FormattedText(this.DataContext.ToString(), CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, 11, renderBrush); 197 | formattedText.TextAlignment = TextAlignment.Right; 198 | var anchor = adornedElementRect.TopRight; 199 | anchor.Offset(0, -formattedText.Height); 200 | 201 | drawingContext.DrawText(formattedText, anchor); 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommitFormatter.TeamFoundation.14.0")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommitFormatter.TeamFoundation.14.0")] 13 | [assembly: AssemblyCopyright("Copyright © 2015-2017 Kristian Adrup")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4b8c9b91-e3f3-4ba6-ae7b-2aee47b8778b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/SettingsSection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using Adrup.CommitFormatter.Core; 15 | using Microsoft.TeamExplorerSample; 16 | using Microsoft.TeamFoundation.Controls; 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using System.Text; 21 | using System.Threading.Tasks; 22 | 23 | namespace Adrup.CommitFormatter.TeamFoundation 24 | { 25 | [TeamExplorerSection(SettingsSection.SectionId, TeamExplorerPageIds.GitSettings, 900)] 26 | public class SettingsSection : TeamExplorerBaseSection 27 | { 28 | public const string SectionId = "0470ed5b-d583-4d5e-b2e7-3d35225f93c6"; 29 | 30 | private FormatterSettings _settings; 31 | 32 | public SettingsSection() : base() 33 | { 34 | Title = "Commit Formatter Settings"; 35 | SectionContent = new SettingsSectionView(); 36 | } 37 | 38 | public override void Initialize(object sender, SectionInitializeEventArgs e) 39 | { 40 | base.Initialize(sender, e); 41 | 42 | _settings = new FormatterSettings(ServiceProvider); 43 | var view = (SettingsSectionView)SectionContent; 44 | view.txtSubjectWidth.Text = _settings.SubjectWidth.ToString(); 45 | view.txtBodyWidth.Text = _settings.BodyWidth.ToString(); 46 | view.txtFontSize.Text = _settings.FontSize.ToString(); 47 | view.chkUseMonospacedFont.IsChecked = _settings.UseMonospacedFont; 48 | view.chkBlankSecondLine.IsChecked = _settings.BlankSecondLine; 49 | view.chkEnableSpellCheck.IsChecked = _settings.EnableSpellCheck; 50 | } 51 | 52 | public override void SaveContext(object sender, SectionSaveContextEventArgs e) 53 | { 54 | var view = SectionContent as SettingsSectionView; 55 | 56 | int value; 57 | if (int.TryParse(view.txtSubjectWidth.Text, out value)) _settings.SubjectWidth = value; 58 | if (int.TryParse(view.txtBodyWidth.Text, out value)) _settings.BodyWidth = value; 59 | if (int.TryParse(view.txtFontSize.Text, out value)) _settings.FontSize = value; 60 | _settings.UseMonospacedFont = view.chkUseMonospacedFont.IsChecked.Value; 61 | _settings.BlankSecondLine = view.chkBlankSecondLine.IsChecked.Value; 62 | _settings.EnableSpellCheck = view.chkEnableSpellCheck.IsChecked.Value; 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/SettingsSectionView.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Blank Second Line 36 | 37 | Use Monospaced Font 38 | 39 | Enable Spell Check 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/SettingsSectionView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Adrup.CommitFormatter.TeamFoundation 17 | { 18 | /// 19 | /// Interaction logic for SettingsSectionView.xaml 20 | /// 21 | public partial class SettingsSectionView : UserControl 22 | { 23 | public SettingsSectionView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/TeamExplorerBase/TeamExplorerBase.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. This code released 3 | * under the terms of the Microsoft Limited Public License (MS-LPL). 4 | */ 5 | using System; 6 | using System.ComponentModel; 7 | using System.Diagnostics; 8 | using Microsoft.TeamFoundation.Client; 9 | using Microsoft.TeamFoundation.Controls; 10 | 11 | namespace Microsoft.TeamExplorerSample 12 | { 13 | /// 14 | /// Team Explorer plugin common base class. 15 | /// 16 | public class TeamExplorerBase : IDisposable, INotifyPropertyChanged 17 | { 18 | #region Members 19 | 20 | private bool m_contextSubscribed = false; 21 | 22 | #endregion 23 | 24 | /// 25 | /// Get/set the service provider. 26 | /// 27 | public IServiceProvider ServiceProvider 28 | { 29 | get { return m_serviceProvider; } 30 | set 31 | { 32 | // Unsubscribe from Team Foundation context changes 33 | if (m_serviceProvider != null) 34 | { 35 | UnsubscribeContextChanges(); 36 | } 37 | 38 | m_serviceProvider = value; 39 | 40 | // Subscribe to Team Foundation context changes 41 | if (m_serviceProvider != null) 42 | { 43 | SubscribeContextChanges(); 44 | } 45 | } 46 | } 47 | private IServiceProvider m_serviceProvider = null; 48 | 49 | /// 50 | /// Get the requested service from the service provider. 51 | /// 52 | public T GetService() 53 | { 54 | Debug.Assert(this.ServiceProvider != null, "GetService called before service provider is set"); 55 | if (this.ServiceProvider != null) 56 | { 57 | return (T)this.ServiceProvider.GetService(typeof(T)); 58 | } 59 | 60 | return default(T); 61 | } 62 | 63 | /// 64 | /// Show a notification in the Team Explorer window. 65 | /// 66 | protected Guid ShowNotification(string message, NotificationType type) 67 | { 68 | ITeamExplorer teamExplorer = GetService(); 69 | if (teamExplorer != null) 70 | { 71 | Guid guid = Guid.NewGuid(); 72 | teamExplorer.ShowNotification(message, type, NotificationFlags.None, null, guid); 73 | return guid; 74 | } 75 | 76 | return Guid.Empty; 77 | } 78 | 79 | #region IDisposable 80 | 81 | /// 82 | /// Dispose. 83 | /// 84 | public virtual void Dispose() 85 | { 86 | UnsubscribeContextChanges(); 87 | } 88 | 89 | #endregion 90 | 91 | #region INotifyPropertyChanged 92 | 93 | public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 94 | 95 | /// 96 | /// Raise the PropertyChanged event for the specified property. 97 | /// 98 | /// Property name 99 | protected void RaisePropertyChanged(string propertyName) 100 | { 101 | if (this.PropertyChanged != null) 102 | { 103 | this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 104 | } 105 | } 106 | 107 | #endregion 108 | 109 | #region Team Foundation Context 110 | 111 | /// 112 | /// Subscribe to context changes. 113 | /// 114 | protected void SubscribeContextChanges() 115 | { 116 | Debug.Assert(this.ServiceProvider != null, "ServiceProvider must be set before subscribing to context changes"); 117 | if (this.ServiceProvider == null || m_contextSubscribed) 118 | { 119 | return; 120 | } 121 | 122 | ITeamFoundationContextManager tfContextManager = GetService(); 123 | if (tfContextManager != null) 124 | { 125 | tfContextManager.ContextChanged += ContextChanged; 126 | m_contextSubscribed = true; 127 | } 128 | } 129 | 130 | /// 131 | /// Unsubscribe from context changes. 132 | /// 133 | protected void UnsubscribeContextChanges() 134 | { 135 | if (this.ServiceProvider == null || !m_contextSubscribed) 136 | { 137 | return; 138 | } 139 | 140 | ITeamFoundationContextManager tfContextManager = GetService(); 141 | if (tfContextManager != null) 142 | { 143 | tfContextManager.ContextChanged -= ContextChanged; 144 | } 145 | } 146 | 147 | /// 148 | /// ContextChanged event handler. 149 | /// 150 | protected virtual void ContextChanged(object sender, ContextChangedEventArgs e) 151 | { 152 | } 153 | 154 | /// 155 | /// Get the current Team Foundation context. 156 | /// 157 | protected ITeamFoundationContext CurrentContext 158 | { 159 | get 160 | { 161 | ITeamFoundationContextManager tfContextManager = GetService(); 162 | if (tfContextManager != null) 163 | { 164 | return tfContextManager.CurrentContext; 165 | } 166 | 167 | return null; 168 | } 169 | } 170 | 171 | #endregion 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/TeamExplorerBase/TeamExplorerBaseNavigationItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. This code released 3 | * under the terms of the Microsoft Limited Public License (MS-LPL). 4 | */ 5 | using System; 6 | using System.ComponentModel.Composition; 7 | using Microsoft.TeamFoundation.Controls; 8 | 9 | namespace Microsoft.TeamExplorerSample 10 | { 11 | /// 12 | /// Team Explorer base navigation item class. 13 | /// 14 | public class TeamExplorerBaseNavigationItem : TeamExplorerBase, ITeamExplorerNavigationItem 15 | { 16 | /// 17 | /// Constructor. 18 | /// 19 | public TeamExplorerBaseNavigationItem(IServiceProvider serviceProvider) 20 | { 21 | this.ServiceProvider = serviceProvider; 22 | } 23 | 24 | #region ITeamExplorerNavigationItem 25 | 26 | /// 27 | /// Get/set the item text. 28 | /// 29 | public string Text 30 | { 31 | get { return m_text; } 32 | set { m_text = value; RaisePropertyChanged("Text"); } 33 | } 34 | private string m_text; 35 | 36 | /// 37 | /// Get/set the item image. 38 | /// 39 | public System.Drawing.Image Image 40 | { 41 | get { return m_image; } 42 | set { m_image = value; RaisePropertyChanged("Image"); } 43 | } 44 | private System.Drawing.Image m_image; 45 | 46 | /// 47 | /// Get/set the IsVisible flag. 48 | /// 49 | public bool IsVisible 50 | { 51 | get { return m_isVisible; } 52 | set { m_isVisible = value; RaisePropertyChanged("IsVisible"); } 53 | } 54 | private bool m_isVisible = true; 55 | 56 | /// 57 | /// Invalidate the item state. 58 | /// 59 | public virtual void Invalidate() 60 | { 61 | } 62 | 63 | /// 64 | /// Execute the item action. 65 | /// 66 | public virtual void Execute() 67 | { 68 | } 69 | 70 | #endregion 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/TeamExplorerBase/TeamExplorerBaseNavigationLink.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. This code released 3 | * under the terms of the Microsoft Limited Public License (MS-LPL). 4 | */ 5 | using System; 6 | using System.ComponentModel.Composition; 7 | using Microsoft.TeamFoundation.Controls; 8 | 9 | namespace Microsoft.TeamExplorerSample 10 | { 11 | /// 12 | /// Team Explorer base navigation link class. 13 | /// 14 | public class TeamExplorerBaseNavigationLink : TeamExplorerBase, ITeamExplorerNavigationLink 15 | { 16 | /// 17 | /// Constructor. 18 | /// 19 | public TeamExplorerBaseNavigationLink(IServiceProvider serviceProvider) 20 | { 21 | this.ServiceProvider = serviceProvider; 22 | } 23 | 24 | #region ITeamExplorerNavigationLink 25 | 26 | /// 27 | /// Get/set the item text. 28 | /// 29 | public string Text 30 | { 31 | get { return m_text; } 32 | set { m_text = value; RaisePropertyChanged("Text"); } 33 | } 34 | private string m_text; 35 | 36 | /// 37 | /// Get/set the IsEnabled flag. 38 | /// 39 | public bool IsEnabled 40 | { 41 | get { return m_isEnabled; } 42 | set { m_isEnabled = value; RaisePropertyChanged("IsEnabled"); } 43 | } 44 | private bool m_isEnabled = true; 45 | 46 | /// 47 | /// Get/set the IsVisible flag. 48 | /// 49 | public bool IsVisible 50 | { 51 | get { return m_isVisible; } 52 | set { m_isVisible = value; RaisePropertyChanged("IsVisible"); } 53 | } 54 | private bool m_isVisible = true; 55 | 56 | /// 57 | /// Invalidate the link state. 58 | /// 59 | public virtual void Invalidate() 60 | { 61 | } 62 | 63 | /// 64 | /// Execute the link action. 65 | /// 66 | public virtual void Execute() 67 | { 68 | } 69 | 70 | #endregion 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/TeamExplorerBase/TeamExplorerBasePage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. This code released 3 | * under the terms of the Microsoft Limited Public License (MS-LPL). 4 | */ 5 | using System; 6 | using System.ComponentModel; 7 | using Microsoft.TeamFoundation.Controls; 8 | 9 | namespace Microsoft.TeamExplorerSample 10 | { 11 | /// 12 | /// Team Explorer page base class. 13 | /// 14 | public class TeamExplorerBasePage : TeamExplorerBase, ITeamExplorerPage 15 | { 16 | #region ITeamExplorerPage 17 | 18 | /// 19 | /// Initialize the page. 20 | /// 21 | public virtual void Initialize(object sender, PageInitializeEventArgs e) 22 | { 23 | this.ServiceProvider = e.ServiceProvider; 24 | } 25 | 26 | /// 27 | /// Loaded handler that is called once the page and all sections 28 | /// have been initialized. 29 | /// 30 | public virtual void Loaded(object sender, PageLoadedEventArgs e) 31 | { 32 | } 33 | 34 | /// 35 | /// Save context handler that is called before a page is unloaded. 36 | /// 37 | public virtual void SaveContext(object sender, PageSaveContextEventArgs e) 38 | { 39 | } 40 | 41 | /// 42 | /// Get/set the page title. 43 | /// 44 | public string Title 45 | { 46 | get { return m_title; } 47 | set { m_title = value; RaisePropertyChanged("Title"); } 48 | } 49 | private string m_title; 50 | 51 | /// 52 | /// Get/set the page content. 53 | /// 54 | public object PageContent 55 | { 56 | get { return m_pageContent; } 57 | set { m_pageContent = value; RaisePropertyChanged("PageContent"); } 58 | } 59 | private object m_pageContent; 60 | 61 | /// 62 | /// Get/set the IsBusy flag. 63 | /// 64 | public bool IsBusy 65 | { 66 | get { return m_isBusy; } 67 | set { m_isBusy = value; RaisePropertyChanged("IsBusy"); } 68 | } 69 | private bool m_isBusy = false; 70 | 71 | /// 72 | /// Refresh the page contents. 73 | /// 74 | public virtual void Refresh() 75 | { 76 | } 77 | 78 | /// 79 | /// Cancel any running operations. 80 | /// 81 | public virtual void Cancel() 82 | { 83 | } 84 | 85 | /// 86 | /// Get the requested extensibility service from the page. Return 87 | /// null if the service is not offered by this page. 88 | /// 89 | public virtual object GetExtensibilityService(Type serviceType) 90 | { 91 | return null; 92 | } 93 | 94 | #endregion 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.14.0/TeamExplorerBase/TeamExplorerBaseSection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. This code released 3 | * under the terms of the Microsoft Limited Public License (MS-LPL). 4 | */ 5 | using System; 6 | using System.ComponentModel; 7 | using Microsoft.TeamFoundation.Controls; 8 | 9 | namespace Microsoft.TeamExplorerSample 10 | { 11 | /// 12 | /// Team Explorer base section class. 13 | /// 14 | public class TeamExplorerBaseSection : TeamExplorerBase, ITeamExplorerSection 15 | { 16 | #region ITeamExplorerSection 17 | 18 | /// 19 | /// Initialize the section. 20 | /// 21 | public virtual void Initialize(object sender, SectionInitializeEventArgs e) 22 | { 23 | this.ServiceProvider = e.ServiceProvider; 24 | } 25 | 26 | /// 27 | /// Save context handler that is called before a section is unloaded. 28 | /// 29 | public virtual void SaveContext(object sender, SectionSaveContextEventArgs e) 30 | { 31 | } 32 | 33 | /// 34 | /// Get/set the section title. 35 | /// 36 | public string Title 37 | { 38 | get { return m_title; } 39 | set { m_title = value; RaisePropertyChanged("Title"); } 40 | } 41 | private string m_title; 42 | 43 | /// 44 | /// Get/set the section content. 45 | /// 46 | public object SectionContent 47 | { 48 | get { return m_sectionContent; } 49 | set { m_sectionContent = value; RaisePropertyChanged("SectionContent"); } 50 | } 51 | private object m_sectionContent; 52 | 53 | /// 54 | /// Get/set the IsVisible flag. 55 | /// 56 | public bool IsVisible 57 | { 58 | get { return m_isVisible; } 59 | set { m_isVisible = value; RaisePropertyChanged("IsVisible"); } 60 | } 61 | private bool m_isVisible = true; 62 | 63 | /// 64 | /// Get/set the IsExpanded flag. 65 | /// 66 | public bool IsExpanded 67 | { 68 | get { return m_isExpanded; } 69 | set { m_isExpanded = value; RaisePropertyChanged("IsExpanded"); } 70 | } 71 | private bool m_isExpanded = true; 72 | 73 | /// 74 | /// Get/set the IsBusy flag. 75 | /// 76 | public bool IsBusy 77 | { 78 | get { return m_isBusy; } 79 | set { m_isBusy = value; RaisePropertyChanged("IsBusy"); } 80 | } 81 | private bool m_isBusy = false; 82 | 83 | /// 84 | /// Called when the section is loaded. 85 | /// 86 | /// 87 | /// 88 | public virtual void Loaded(object sender, SectionLoadedEventArgs e) 89 | { 90 | } 91 | 92 | /// 93 | /// Refresh the section contents. 94 | /// 95 | public virtual void Refresh() 96 | { 97 | } 98 | 99 | /// 100 | /// Cancel any running operations. 101 | /// 102 | public virtual void Cancel() 103 | { 104 | } 105 | 106 | /// 107 | /// Get the requested extensibility service from the section. Return 108 | /// null if the service is not offered by this section. 109 | /// 110 | public virtual object GetExtensibilityService(Type serviceType) 111 | { 112 | return null; 113 | } 114 | 115 | #endregion 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.15.0/CommitFormatter.TeamFoundation.15.0.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE} 8 | Library 9 | Properties 10 | Adrup.CommitFormatter.TeamFoundation 11 | Adrup.CommitFormatter.TeamFoundation.15.0 12 | v4.6.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | False 35 | ..\lib\15.0\Microsoft.TeamFoundation.Client.dll 36 | False 37 | 38 | 39 | False 40 | ..\lib\15.0\Microsoft.TeamFoundation.Common.dll 41 | False 42 | 43 | 44 | False 45 | ..\lib\15.0\Microsoft.TeamFoundation.Controls.dll 46 | False 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | FormatterSection.cs 66 | 67 | 68 | SettingsSection.cs 69 | 70 | 71 | SettingsSectionView.xaml.cs 72 | SettingsSectionView.xaml 73 | 74 | 75 | TeamExplorerBase\TeamExplorerBase.cs 76 | 77 | 78 | TeamExplorerBase\TeamExplorerBaseNavigationItem.cs 79 | 80 | 81 | TeamExplorerBase\TeamExplorerBaseNavigationLink.cs 82 | 83 | 84 | TeamExplorerBase\TeamExplorerBasePage.cs 85 | 86 | 87 | TeamExplorerBase\TeamExplorerBaseSection.cs 88 | 89 | 90 | 91 | 92 | 93 | {f381663e-9afe-499a-8c16-770ab9c33977} 94 | CommitFormatter.Core 95 | 96 | 97 | 98 | 99 | SettingsSectionView.xaml 100 | MSBuild:Compile 101 | Designer 102 | 103 | 104 | 105 | 112 | -------------------------------------------------------------------------------- /CommitFormatter.TeamFoundation.15.0/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommitFormatter.TeamFoundation.15.0")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommitFormatter.TeamFoundation.15.0")] 13 | [assembly: AssemblyCopyright("Copyright © 2015-2017 Kristian Adrup")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("dc93d32a-fef5-4a1b-aad4-b81b9bebc4ce")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CommitFormatter.Tests/CommitFormatter.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {54F26C23-DE38-478A-A9F4-A68AFFD101C2} 7 | Library 8 | Properties 9 | Adrup.CommitFormatter.Tests 10 | Adrup.CommitFormatter.Tests 11 | v4.6.1 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | {f381663e-9afe-499a-8c16-770ab9c33977} 60 | CommitFormatter.Core 61 | 62 | 63 | 64 | 65 | 66 | 67 | False 68 | 69 | 70 | False 71 | 72 | 73 | False 74 | 75 | 76 | False 77 | 78 | 79 | 80 | 81 | 82 | 83 | 90 | -------------------------------------------------------------------------------- /CommitFormatter.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommitFormatter.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommitFormatter.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2015-2017 Kristian Adrup")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("54f26c23-de38-478a-a9f4-a68affd101c2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CommitFormatter.Tests/TokenizeTests.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using System; 15 | using System.Linq; 16 | using Microsoft.VisualStudio.TestTools.UnitTesting; 17 | using Adrup.CommitFormatter.Core; 18 | 19 | namespace Adrup.CommitFormatter.Tests 20 | { 21 | [TestClass] 22 | public class TokenizeTests 23 | { 24 | 25 | [TestMethod] 26 | public void Tokenize_StandardText() 27 | { 28 | string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; 29 | int caretIndex = 0; 30 | int caretIndexDelta = 0; 31 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 32 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit." }; 33 | CollectionAssert.AreEqual(expected, actual); 34 | } 35 | 36 | [TestMethod] 37 | public void Tokenize_SingleLeadingWhitespace() 38 | { 39 | string text = " Lorem ipsum dolor sit amet, consectetur adipiscing elit."; 40 | int caretIndex = 0; 41 | int caretIndexDelta = 0; 42 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 43 | var expected = new[] { " ", "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit." }; 44 | CollectionAssert.AreEqual(expected, actual); 45 | } 46 | 47 | [TestMethod] 48 | public void Tokenize_MultipleLeadingWhitespace() 49 | { 50 | string text = " Lorem ipsum dolor sit amet, consectetur adipiscing elit."; 51 | int caretIndex = 0; 52 | int caretIndexDelta = 0; 53 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 54 | var expected = new[] { " ", " ", " ", "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit." }; 55 | CollectionAssert.AreEqual(expected, actual); 56 | } 57 | 58 | [TestMethod] 59 | public void Tokenize_SingleTrailingWhitespace() 60 | { 61 | string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "; 62 | int caretIndex = 0; 63 | int caretIndexDelta = 0; 64 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 65 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " " }; 66 | CollectionAssert.AreEqual(expected, actual); 67 | } 68 | 69 | [TestMethod] 70 | public void Tokenize_MultipleTrailingWhitespace() 71 | { 72 | string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "; 73 | int caretIndex = 0; 74 | int caretIndexDelta = 0; 75 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 76 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 77 | CollectionAssert.AreEqual(expected, actual); 78 | } 79 | 80 | [TestMethod] 81 | public void Tokenize_ContainsCRLF() 82 | { 83 | string text = "Lorem ipsum dolor sit amet, \r\nconsectetur adipiscing elit. "; 84 | int caretIndex = 0; 85 | int caretIndexDelta = 0; 86 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 87 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "\r", "\n", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 88 | CollectionAssert.AreEqual(expected, actual); 89 | } 90 | 91 | [TestMethod] 92 | public void Tokenize_ContainsLF_ShouldRemoveLF() 93 | { 94 | string text = "Lorem ipsum dolor sit amet, \nconsectetur adipiscing elit. "; 95 | int caretIndex = 0; 96 | int caretIndexDelta = 0; 97 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 98 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 99 | CollectionAssert.AreEqual(expected, actual); 100 | } 101 | 102 | [TestMethod] 103 | public void Tokenize_ContainsSequentialLF_ShouldRemoveLF() 104 | { 105 | string text = "Lorem ipsum dolor sit amet, \n\nconsectetur adipiscing elit. "; 106 | int caretIndex = 0; 107 | int caretIndexDelta = 0; 108 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 109 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 110 | CollectionAssert.AreEqual(expected, actual); 111 | } 112 | 113 | [TestMethod] 114 | public void Tokenize_SingleLF_ShouldReturnEmpty() 115 | { 116 | string text = "\n"; 117 | int caretIndex = 0; 118 | int caretIndexDelta = 0; 119 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 120 | Assert.AreEqual(0, actual.Length); 121 | } 122 | 123 | [TestMethod] 124 | public void Tokenize_SingleLFWithTrailingWhitespace() 125 | { 126 | string text = "\n "; 127 | int caretIndex = 0; 128 | int caretIndexDelta = 0; 129 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 130 | var expected = new[] { " " }; 131 | CollectionAssert.AreEqual(expected, actual); 132 | } 133 | 134 | [TestMethod] 135 | public void Tokenize_SingleLFWithLeadingAndTrailingWhitespace() 136 | { 137 | string text = " \n "; 138 | int caretIndex = 0; 139 | int caretIndexDelta = 0; 140 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 141 | var expected = new[] { " ", " " }; 142 | CollectionAssert.AreEqual(expected, actual); 143 | } 144 | 145 | [TestMethod] 146 | public void Tokenize_SingleCRLF() 147 | { 148 | string text = "\r\n"; 149 | int caretIndex = 0; 150 | int caretIndexDelta = 0; 151 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 152 | var expected = new[] { "\r", "\n" }; 153 | CollectionAssert.AreEqual(expected, actual); 154 | } 155 | 156 | [TestMethod] 157 | public void Tokenize_CRLFWithTrailingWhitespace() 158 | { 159 | string text = "\r\n "; 160 | int caretIndex = 0; 161 | int caretIndexDelta = 0; 162 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 163 | var expected = new[] { "\r", "\n", " " }; 164 | CollectionAssert.AreEqual(expected, actual); 165 | } 166 | 167 | [TestMethod] 168 | public void Tokenize_CRLFWithLeadingAndTrailingWhitespace() 169 | { 170 | string text = " \r\n "; 171 | int caretIndex = 0; 172 | int caretIndexDelta = 0; 173 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 174 | var expected = new[] { " ", "\r", "\n", " " }; 175 | CollectionAssert.AreEqual(expected, actual); 176 | } 177 | 178 | [TestMethod] 179 | public void Tokenize_EmptyString() 180 | { 181 | string text = ""; 182 | int caretIndex = 0; 183 | int caretIndexDelta = 0; 184 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 185 | Assert.AreEqual(0, actual.Length); 186 | } 187 | 188 | [TestMethod] 189 | public void Tokenize_SingleWhitespaceOnly() 190 | { 191 | string text = " "; 192 | int caretIndex = 0; 193 | int caretIndexDelta = 0; 194 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 195 | var expected = new[] { " " }; 196 | CollectionAssert.AreEqual(expected, actual); 197 | } 198 | 199 | [TestMethod] 200 | public void Tokenize_MultipleWhitespaceOnly() 201 | { 202 | string text = " "; 203 | int caretIndex = 0; 204 | int caretIndexDelta = 0; 205 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 206 | var expected = new[] { " ", " ", " " }; 207 | CollectionAssert.AreEqual(expected, actual); 208 | } 209 | 210 | [TestMethod] 211 | public void Tokenize_ContainsLFBeforeCaret_ShouldDecreaseOffset() 212 | { 213 | string text = "Lorem ipsum dolor sit amet, \n\nconsectetur adipiscing elit. "; 214 | int caretIndex = 35; 215 | int caretIndexDelta = 0; 216 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 217 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 218 | CollectionAssert.AreEqual(expected, actual); 219 | Assert.AreEqual(-2, caretIndexDelta); 220 | } 221 | 222 | [TestMethod] 223 | public void Tokenize_ContainsLFJustBeforeCaret_ShouldDecreaseOffset() 224 | { 225 | string text = "Lorem ipsum dolor sit amet, \n\nconsectetur adipiscing elit. "; 226 | int caretIndex = 30; 227 | int caretIndexDelta = 0; 228 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 229 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 230 | CollectionAssert.AreEqual(expected, actual); 231 | Assert.AreEqual(-2, caretIndexDelta); 232 | } 233 | 234 | [TestMethod] 235 | public void Tokenize_ContainsLFJustAfterCaret_ShouldNotChangeOffset() 236 | { 237 | string text = "Lorem ipsum dolor sit amet, \n\nconsectetur adipiscing elit. "; 238 | int caretIndex = 28; 239 | int caretIndexDelta = 0; 240 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 241 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 242 | CollectionAssert.AreEqual(expected, actual); 243 | Assert.AreEqual(0, caretIndexDelta); 244 | } 245 | 246 | [TestMethod] 247 | public void Tokenize_ContainsLFJusteforeAndAfterCaret_ShouldDecreaseOffsetByOne() 248 | { 249 | string text = "Lorem ipsum dolor sit amet, \n\nconsectetur adipiscing elit. "; 250 | int caretIndex = 29; 251 | int caretIndexDelta = 0; 252 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 253 | var expected = new[] { "Lorem", " ", "ipsum", " ", "dolor", " ", "sit", " ", "amet,", " ", "consectetur", " ", "adipiscing", " ", "elit.", " ", " ", " " }; 254 | CollectionAssert.AreEqual(expected, actual); 255 | Assert.AreEqual(-1, caretIndexDelta); 256 | } 257 | 258 | [TestMethod] 259 | public void Tokenize_Unicode() 260 | { 261 | string text = "Эи еюж ютроквюы окюррырэт, \nпюрто нонюмэш номинави эи вяш"; 262 | int caretIndex = 28; 263 | int caretIndexDelta = 0; 264 | var actual = TextHelper.Tokenize(text, caretIndex, out caretIndexDelta); 265 | var expected = new[] { "Эи", " ", "еюж", " ", "ютроквюы", " ", "окюррырэт,", " ", "пюрто", " ", "нонюмэш", " ", "номинави", " ", "эи", " ", "вяш" }; 266 | CollectionAssert.AreEqual(expected, actual); 267 | Assert.AreEqual(-1, caretIndexDelta); 268 | } 269 | 270 | // 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /CommitFormatter.Tests/WrapTest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using System; 15 | using System.Linq; 16 | using Microsoft.VisualStudio.TestTools.UnitTesting; 17 | using Adrup.CommitFormatter.Core; 18 | 19 | namespace Adrup.CommitFormatter.Tests 20 | { 21 | [TestClass] 22 | public class WrapTest 23 | { 24 | private const int SubjectWidth = 10; 25 | private const int BodyWidth = 15; 26 | 27 | [TestMethod] 28 | public void Wrap_StandardText() 29 | { 30 | string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; 31 | int caretIndex = 0; 32 | int caretIndexDelta = 0; 33 | var actual = TextHelper.Wrap(text, caretIndex, SubjectWidth, BodyWidth, false, out caretIndexDelta); 34 | var expected = "Lorem \nipsum dolor \nsit amet, \nconsectetur \nadipiscing \nelit."; 35 | Assert.AreEqual(expected, actual); 36 | } 37 | 38 | [TestMethod] 39 | public void Wrap_ContainsLF_ShouldDisregardExistingLF() 40 | { 41 | string text = "Lorem \nipsum \ndolor \nsit\n amet, \nconsectetur \nadipiscing\n elit.\n"; 42 | int caretIndex = 14; 43 | int caretIndexDelta = 0; 44 | 45 | var actual = TextHelper.Wrap(text, caretIndex, SubjectWidth, BodyWidth, false, out caretIndexDelta); 46 | var expected = "Lorem \nipsum dolor \nsit amet, \nconsectetur \nadipiscing \nelit."; 47 | int charsLeft = TextHelper.CountLineCharsLeft(actual, caretIndex + caretIndexDelta, SubjectWidth, BodyWidth, false); 48 | Assert.AreEqual(expected, actual); 49 | Assert.AreEqual(-1, caretIndexDelta); 50 | Assert.AreEqual(3, charsLeft); 51 | } 52 | 53 | [TestMethod] 54 | public void Wrap_ContainsCRLF_ShouldKeepExistingCRLF() 55 | { 56 | string text = "Lorem ipsum dolor sit\r\n amet, consectetur adipiscing\n elit.\n"; 57 | int caretIndex = 54; 58 | int caretIndexDelta = 0; 59 | var actual = TextHelper.Wrap(text, caretIndex, SubjectWidth, BodyWidth, false, out caretIndexDelta); 60 | var expected = "Lorem \nipsum dolor sit\r\n amet, \nconsectetur \nadipiscing \nelit."; 61 | int charsLeft = TextHelper.CountLineCharsLeft(actual, caretIndex + caretIndexDelta, SubjectWidth, BodyWidth, false); 62 | Assert.AreEqual(expected, actual); 63 | Assert.AreEqual(3, caretIndexDelta); 64 | Assert.AreEqual(10, charsLeft); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /CommitFormatter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26206.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommitFormatter", "CommitFormatter\CommitFormatter.csproj", "{1484406E-214F-4271-A3A9-3416E40F3E32}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommitFormatter.Tests", "CommitFormatter.Tests\CommitFormatter.Tests.csproj", "{54F26C23-DE38-478A-A9F4-A68AFFD101C2}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommitFormatter.Core", "CommitFormatter.Core\CommitFormatter.Core.csproj", "{F381663E-9AFE-499A-8C16-770AB9C33977}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommitFormatter.TeamFoundation.14.0", "CommitFormatter.TeamFoundation.14.0\CommitFormatter.TeamFoundation.14.0.csproj", "{4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommitFormatter.TeamFoundation.15.0", "CommitFormatter.TeamFoundation.15.0\CommitFormatter.TeamFoundation.15.0.csproj", "{DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3F07D13F-C37D-4043-8513-8943B2C8B8E4}" 17 | ProjectSection(SolutionItems) = preProject 18 | README.md = README.md 19 | EndProjectSection 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Any CPU = Debug|Any CPU 24 | Release|Any CPU = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {1484406E-214F-4271-A3A9-3416E40F3E32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {1484406E-214F-4271-A3A9-3416E40F3E32}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {1484406E-214F-4271-A3A9-3416E40F3E32}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {1484406E-214F-4271-A3A9-3416E40F3E32}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {54F26C23-DE38-478A-A9F4-A68AFFD101C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {54F26C23-DE38-478A-A9F4-A68AFFD101C2}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {54F26C23-DE38-478A-A9F4-A68AFFD101C2}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {54F26C23-DE38-478A-A9F4-A68AFFD101C2}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {F381663E-9AFE-499A-8C16-770AB9C33977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {F381663E-9AFE-499A-8C16-770AB9C33977}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {F381663E-9AFE-499A-8C16-770AB9C33977}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {F381663E-9AFE-499A-8C16-770AB9C33977}.Release|Any CPU.Build.0 = Release|Any CPU 39 | {4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 40 | {4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B}.Debug|Any CPU.Build.0 = Debug|Any CPU 41 | {4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE}.Release|Any CPU.ActiveCfg = Release|Any CPU 46 | {DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE}.Release|Any CPU.Build.0 = Release|Any CPU 47 | EndGlobalSection 48 | GlobalSection(SolutionProperties) = preSolution 49 | HideSolutionNode = FALSE 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /CommitFormatter/CommitFormatter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 15.0 6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 7 | 8 | 9 | true 10 | 11 | 12 | 13 | 14 | 14.0 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | false 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Debug 41 | AnyCPU 42 | 2.0 43 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 44 | {1484406E-214F-4271-A3A9-3416E40F3E32} 45 | Library 46 | Properties 47 | Adrup.CommitFormatter 48 | Adrup.CommitFormatter 49 | v4.6.1 50 | true 51 | true 52 | true 53 | true 54 | true 55 | false 56 | 57 | 58 | true 59 | full 60 | false 61 | bin\Debug\ 62 | DEBUG;TRACE 63 | prompt 64 | 4 65 | 66 | 67 | pdbonly 68 | true 69 | bin\Release\ 70 | TRACE 71 | prompt 72 | 4 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Designer 83 | 84 | 85 | 86 | 87 | Always 88 | true 89 | 90 | 91 | 92 | Always 93 | true 94 | 95 | 96 | Always 97 | true 98 | 99 | 100 | 101 | 102 | False 103 | 104 | 105 | False 106 | 107 | 108 | False 109 | 110 | 111 | False 112 | 113 | 114 | 115 | 116 | False 117 | 118 | 119 | ..\packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll 120 | True 121 | 122 | 123 | ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll 124 | True 125 | 126 | 127 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll 128 | True 129 | 130 | 131 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll 132 | True 133 | 134 | 135 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll 136 | True 137 | 138 | 139 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll 140 | True 141 | 142 | 143 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll 144 | True 145 | 146 | 147 | ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll 148 | True 149 | 150 | 151 | True 152 | ..\packages\Microsoft.VisualStudio.Shell.Interop.10.0.10.0.30319\lib\Microsoft.VisualStudio.Shell.Interop.10.0.dll 153 | True 154 | 155 | 156 | True 157 | ..\packages\Microsoft.VisualStudio.Shell.Interop.11.0.11.0.61030\lib\Microsoft.VisualStudio.Shell.Interop.11.0.dll 158 | True 159 | 160 | 161 | True 162 | ..\packages\Microsoft.VisualStudio.Shell.Interop.12.0.12.0.30110\lib\Microsoft.VisualStudio.Shell.Interop.12.0.dll 163 | True 164 | 165 | 166 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 167 | True 168 | 169 | 170 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll 171 | True 172 | 173 | 174 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll 175 | True 176 | 177 | 178 | ..\packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll 179 | True 180 | 181 | 182 | ..\packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll 183 | True 184 | 185 | 186 | ..\packages\Microsoft.VisualStudio.Utilities.14.3.25407\lib\net45\Microsoft.VisualStudio.Utilities.dll 187 | True 188 | 189 | 190 | ..\packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll 191 | True 192 | 193 | 194 | False 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | true 206 | VSPackage 207 | 208 | 209 | 210 | 211 | {F381663E-9AFE-499A-8C16-770AB9C33977} 212 | CommitFormatter.Core 213 | BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b 214 | DebugSymbolsProjectOutputGroup%3b 215 | 216 | 217 | {4B8C9B91-E3F3-4BA6-AE7B-2AEE47B8778B} 218 | CommitFormatter.TeamFoundation.14.0 219 | BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b 220 | DebugSymbolsProjectOutputGroup%3b 221 | 222 | 223 | {DC93D32A-FEF5-4A1B-AAD4-B81B9BEBC4CE} 224 | CommitFormatter.TeamFoundation.15.0 225 | BuiltProjectOutputGroup%3bBuiltProjectOutputGroupDependencies%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b 226 | DebugSymbolsProjectOutputGroup%3b 227 | 228 | 229 | 230 | 231 | False 232 | Microsoft .NET Framework 4.6.1 %28x86 and x64%29 233 | true 234 | 235 | 236 | False 237 | .NET Framework 3.5 SP1 238 | false 239 | 240 | 241 | 242 | 243 | 244 | 245 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 246 | 247 | 248 | 249 | 250 | 251 | 258 | -------------------------------------------------------------------------------- /CommitFormatter/CommitFormatterPackage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * CommitFormatter - http://github.com/kria/CommitFormatter 3 | * 4 | * Copyright (C) 2015 Kristian Adrup 5 | * 6 | * This file is part of CommitFormatter. 7 | * 8 | * CommitFormatter is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or (at 11 | * your option) any later version. See included file COPYING for details. 12 | */ 13 | 14 | using System; 15 | using System.Diagnostics; 16 | using System.Globalization; 17 | using System.Runtime.InteropServices; 18 | using System.ComponentModel.Design; 19 | using Microsoft.Win32; 20 | using Microsoft.VisualStudio; 21 | using Microsoft.VisualStudio.Shell.Interop; 22 | using Microsoft.VisualStudio.OLE.Interop; 23 | using Microsoft.VisualStudio.Shell; 24 | 25 | namespace Adrup.CommitFormatter 26 | { 27 | /// 28 | /// This is the class that implements the package exposed by this assembly. 29 | /// 30 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 31 | /// is to implement the IVsPackage interface and register itself with the shell. 32 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 33 | /// to do it: it derives from the Package class that provides the implementation of the 34 | /// IVsPackage interface and uses the registration attributes defined in the framework to 35 | /// register itself and its components with the shell. 36 | /// 37 | // This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is 38 | // a package. 39 | [PackageRegistration(UseManagedResourcesOnly = true)] 40 | // This attribute is used to register the information needed to show this package 41 | // in the Help/About dialog of Visual Studio. 42 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] 43 | [Guid(GuidList.guidCommitFormatterPkgString)] 44 | public sealed class CommitFormatterPackage : Package 45 | { 46 | /// 47 | /// Default constructor of the package. 48 | /// Inside this method you can place any initialization code that does not require 49 | /// any Visual Studio service because at this point the package object is created but 50 | /// not sited yet inside Visual Studio environment. The place to do all the other 51 | /// initialization is the Initialize method. 52 | /// 53 | public CommitFormatterPackage() 54 | { 55 | Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString())); 56 | } 57 | 58 | 59 | 60 | ///////////////////////////////////////////////////////////////////////////// 61 | // Overridden Package Implementation 62 | #region Package Members 63 | 64 | /// 65 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 66 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 67 | /// 68 | protected override void Initialize() 69 | { 70 | Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); 71 | base.Initialize(); 72 | 73 | } 74 | #endregion 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /CommitFormatter/Guids.cs: -------------------------------------------------------------------------------- 1 | // Guids.cs 2 | // MUST match guids.h 3 | using System; 4 | 5 | namespace Adrup.CommitFormatter 6 | { 7 | static class GuidList 8 | { 9 | public const string guidCommitFormatterPkgString = "b633b569-85c0-4bf2-b54e-96022d4b76c5"; 10 | public const string guidCommitFormatterCmdSetString = "ef27c8af-194f-480f-b3eb-a098eff97d42"; 11 | 12 | public static readonly Guid guidCommitFormatterCmdSet = new Guid(guidCommitFormatterCmdSetString); 13 | }; 14 | } -------------------------------------------------------------------------------- /CommitFormatter/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2017 Kristian Adrup 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . -------------------------------------------------------------------------------- /CommitFormatter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Commit Formatter")] 9 | [assembly: AssemblyDescription("A Visual Studio extension that formats Git commit messages.")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Commit Formatter")] 13 | [assembly: AssemblyCopyright("Copyright © 2015-2017 Kristian Adrup")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.4.0.0")] 33 | [assembly: AssemblyFileVersion("1.4.0.0")] 34 | -------------------------------------------------------------------------------- /CommitFormatter/Resources/CommitFormatterPackage.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/CommitFormatter/Resources/CommitFormatterPackage.ico -------------------------------------------------------------------------------- /CommitFormatter/Resources/commit-message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/CommitFormatter/Resources/commit-message.png -------------------------------------------------------------------------------- /CommitFormatter/Resources/git-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/CommitFormatter/Resources/git-icon.png -------------------------------------------------------------------------------- /CommitFormatter/Resources/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/CommitFormatter/Resources/settings.png -------------------------------------------------------------------------------- /CommitFormatter/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Commit Formatter 122 | 123 | 124 | Adds automatic word wrap to the Git commit message textbox. 125 | 126 | 127 | 128 | Resources\CommitFormatterPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /CommitFormatter/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CommitFormatter/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Commit Formatter 6 | Adds automatic word wrap to the Git commit message textbox. 7 | LICENSE.txt 8 | https://github.com/kria/CommitFormatter/releases 9 | Resources\git-icon.png 10 | Resources\settings.png 11 | git;commit;message;wrap;wrapping;line wrap;word wrap;format;formatting;team explorer 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Commit Formatter 2 | 3 | Commit Formatter extends team explorer and adds automatic word wrap to the Git commit message textbox according to the [50/72 style][0]. 4 | A counter let's you keep track of the number of characters left on the current row. Text width, monospaced font and font size can be configured under Git Settings. 5 | 6 | The extension works on Visual Studio 2013, 2015 and 2017. You can download it directly in Visual Studio. 7 | 8 | ![Commit Formatter commit message](https://raw.githubusercontent.com/kria/CommitFormatter/master/CommitFormatter/Resources/commit-message.png) 9 | 10 | ![Commit Formatter commit message](https://raw.githubusercontent.com/kria/CommitFormatter/master/CommitFormatter/Resources/settings.png) 11 | 12 | [0]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 13 | -------------------------------------------------------------------------------- /lib/14.0/Microsoft.TeamFoundation.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/lib/14.0/Microsoft.TeamFoundation.Client.dll -------------------------------------------------------------------------------- /lib/14.0/Microsoft.TeamFoundation.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/lib/14.0/Microsoft.TeamFoundation.Common.dll -------------------------------------------------------------------------------- /lib/14.0/Microsoft.TeamFoundation.Controls.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/lib/14.0/Microsoft.TeamFoundation.Controls.dll -------------------------------------------------------------------------------- /lib/15.0/Microsoft.TeamFoundation.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/lib/15.0/Microsoft.TeamFoundation.Client.dll -------------------------------------------------------------------------------- /lib/15.0/Microsoft.TeamFoundation.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/lib/15.0/Microsoft.TeamFoundation.Common.dll -------------------------------------------------------------------------------- /lib/15.0/Microsoft.TeamFoundation.Controls.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kria/CommitFormatter/64bea5f0183fa50f6f26c92862ea94941b2cbaa1/lib/15.0/Microsoft.TeamFoundation.Controls.dll --------------------------------------------------------------------------------