├── .editorconfig ├── .gitattributes ├── .github ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── README.md ├── TrailingWhitespace.sln ├── appveyor.yml ├── artifacts ├── CSharp.png ├── OptionsDialog.png └── VisualStudioSettings.png └── src ├── Classifier ├── ClassificationTypes.cs ├── Classifier.cs └── ClassifierProvider.cs ├── Commands ├── RemoveWhitespaceCommand.cs ├── RemoveWhitespaceOnSave.cs ├── TextviewCreationListener.cs └── WhitespaceBase.cs ├── Helpers └── FileHelpers.cs ├── Options.cs ├── Properties └── AssemblyInfo.cs ├── Resources ├── License.txt ├── logo.png └── preview.png ├── TrailingWhitespace.csproj ├── VSCommandTable.cs ├── VSCommandTable.vsct ├── VSPackage.cs ├── source.extension.cs └── source.extension.vsixmanifest /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Don't use tabs for indentation. 7 | [*] 8 | indent_style = space 9 | end_of_line = crlf 10 | # (Please don't specify an indent_size here; that has too many unintended consequences.) 11 | 12 | # Code files 13 | [*.{cs,csx,vb,vbx}] 14 | indent_size = 4 15 | 16 | # Xml project files 17 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] 18 | indent_size = 2 19 | 20 | # Xml config files 21 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] 22 | indent_size = 2 23 | 24 | # JSON files 25 | [*.json] 26 | indent_size = 2 27 | 28 | # Dotnet code style settings: 29 | [*.{cs,vb}] 30 | # Sort using and Import directives with System.* appearing first 31 | dotnet_sort_system_directives_first = true 32 | dotnet_separate_import_directive_groups = false 33 | 34 | # Avoid "this." and "Me." if not necessary 35 | dotnet_style_qualification_for_field = false : suggestion 36 | dotnet_style_qualification_for_property = false : suggestion 37 | dotnet_style_qualification_for_method = false : suggestion 38 | dotnet_style_qualification_for_event = false : suggestion 39 | 40 | # Use language keywords instead of framework type names for type references 41 | dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion 42 | dotnet_style_predefined_type_for_member_access = true : suggestion 43 | 44 | # Suggest more modern language features when available 45 | dotnet_style_object_initializer = true : suggestion 46 | dotnet_style_collection_initializer = true : suggestion 47 | dotnet_style_coalesce_expression = true : suggestion 48 | dotnet_style_null_propagation = true : suggestion 49 | dotnet_style_explicit_tuple_names = true : suggestion 50 | 51 | # Naming rules - async methods to be prefixed with Async 52 | dotnet_naming_rule.async_methods_must_end_with_async.severity = warning 53 | dotnet_naming_rule.async_methods_must_end_with_async.symbols = method_symbols 54 | dotnet_naming_rule.async_methods_must_end_with_async.style = end_in_async_style 55 | 56 | dotnet_naming_symbols.method_symbols.applicable_kinds = method 57 | dotnet_naming_symbols.method_symbols.required_modifiers = async 58 | 59 | dotnet_naming_style.end_in_async_style.capitalization = pascal_case 60 | dotnet_naming_style.end_in_async_style.required_suffix = Async 61 | 62 | # Naming rules - private fields must start with an underscore 63 | dotnet_naming_rule.field_must_start_with_underscore.severity = warning 64 | dotnet_naming_rule.field_must_start_with_underscore.symbols = private_fields 65 | dotnet_naming_rule.field_must_start_with_underscore.style = start_underscore_style 66 | 67 | dotnet_naming_symbols.private_fields.applicable_kinds = field 68 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private 69 | 70 | dotnet_naming_style.start_underscore_style.capitalization = camel_case 71 | dotnet_naming_style.start_underscore_style.required_prefix = _ 72 | 73 | # CSharp code style settings: 74 | [*.cs] 75 | # Prefer "var" everywhere 76 | csharp_style_var_for_built_in_types = true : suggestion 77 | csharp_style_var_when_type_is_apparent = true : suggestion 78 | csharp_style_var_elsewhere = false : suggestion 79 | 80 | # Prefer method-like constructs to have a block body 81 | csharp_style_expression_bodied_methods = false : none 82 | csharp_style_expression_bodied_constructors = false : none 83 | csharp_style_expression_bodied_operators = false : none 84 | 85 | # Prefer property-like constructs to have an expression-body 86 | csharp_style_expression_bodied_properties = true : none 87 | csharp_style_expression_bodied_indexers = true : none 88 | csharp_style_expression_bodied_accessors = true : none 89 | 90 | # Suggest more modern language features when available 91 | csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion 92 | csharp_style_pattern_matching_over_as_with_null_check = true : suggestion 93 | csharp_style_inlined_variable_declaration = true : suggestion 94 | csharp_style_throw_expression = true : suggestion 95 | csharp_style_conditional_delegate_call = true : suggestion 96 | 97 | # Newline settings 98 | csharp_new_line_before_open_brace = all 99 | csharp_new_line_before_else = true 100 | csharp_new_line_before_catch = true 101 | csharp_new_line_before_finally = true 102 | csharp_new_line_before_members_in_object_initializers = true 103 | csharp_new_line_before_members_in_anonymous_types = true -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](http://visualstudiogallery.msdn.microsoft.com/a7f75c34-82b4-4357-9c66-c18e32b9393e). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Installed product versions 2 | - Visual Studio: [example 2015 Professional] 3 | - This extension: [example 1.1.21] 4 | 5 | ### Description 6 | Replace this text with a short description 7 | 8 | ### Steps to recreate 9 | 1. Replace this 10 | 2. text with 11 | 3. the steps 12 | 4. to recreate 13 | 14 | ### Current behavior 15 | Explain what it's doing and why it's wrong 16 | 17 | ### Expected behavior 18 | Explain what it should be doing after it's fixed. -------------------------------------------------------------------------------- /.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 | *.sln. 9 | .vs 10 | 11 | # Build results 12 | [Dd]ebug/ 13 | [Dd]ebugPublic/ 14 | [Rr]elease/ 15 | x64/ 16 | build/ 17 | bld/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | 21 | # MSTest test Results 22 | [Tt]est[Rr]esult*/ 23 | [Bb]uild[Ll]og.* 24 | 25 | #NUNIT 26 | *.VisualState.xml 27 | TestResult.xml 28 | 29 | # Build Results of an ATL Project 30 | [Dd]ebugPS/ 31 | [Rr]eleasePS/ 32 | dlldata.c 33 | 34 | *_i.c 35 | *_p.c 36 | *_i.h 37 | *.ilk 38 | *.meta 39 | *.obj 40 | *.pch 41 | *.pdb 42 | *.pgc 43 | *.pgd 44 | *.rsp 45 | *.sbr 46 | *.tlb 47 | *.tli 48 | *.tlh 49 | *.tmp 50 | *.tmp_proj 51 | *.log 52 | *.vspscc 53 | *.vssscc 54 | .builds 55 | *.pidb 56 | *.svclog 57 | *.scc 58 | 59 | # Chutzpah Test files 60 | _Chutzpah* 61 | 62 | # Visual C++ cache files 63 | ipch/ 64 | *.aps 65 | *.ncb 66 | *.opensdf 67 | *.sdf 68 | *.cachefile 69 | 70 | # Visual Studio profiler 71 | *.psess 72 | *.vsp 73 | *.vspx 74 | 75 | # TFS 2012 Local Workspace 76 | $tf/ 77 | 78 | # Guidance Automation Toolkit 79 | *.gpState 80 | 81 | # ReSharper is a .NET coding add-in 82 | _ReSharper*/ 83 | *.[Rr]e[Ss]harper 84 | *.DotSettings.user 85 | 86 | # JustCode is a .NET coding addin-in 87 | .JustCode 88 | 89 | # TeamCity is a build add-in 90 | _TeamCity* 91 | 92 | # DotCover is a Code Coverage Tool 93 | *.dotCover 94 | 95 | # NCrunch 96 | *.ncrunch* 97 | _NCrunch_* 98 | .*crunch*.local.xml 99 | 100 | # MightyMoose 101 | *.mm.* 102 | AutoTest.Net/ 103 | 104 | # Web workbench (sass) 105 | .sass-cache/ 106 | 107 | # Installshield output folder 108 | [Ee]xpress/ 109 | 110 | # DocProject is a documentation generator add-in 111 | DocProject/buildhelp/ 112 | DocProject/Help/*.HxT 113 | DocProject/Help/*.HxC 114 | DocProject/Help/*.hhc 115 | DocProject/Help/*.hhk 116 | DocProject/Help/*.hhp 117 | DocProject/Help/Html2 118 | DocProject/Help/html 119 | 120 | # Click-Once directory 121 | publish/ 122 | 123 | # Publish Web Output 124 | *.[Pp]ublish.xml 125 | *.azurePubxml 126 | 127 | # NuGet Packages Directory 128 | packages/ 129 | ## TODO: If the tool you use requires repositories.config uncomment the next line 130 | #!packages/repositories.config 131 | 132 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 133 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 134 | !packages/build/ 135 | 136 | # Windows Azure Build Output 137 | csx/ 138 | *.build.csdef 139 | 140 | # Windows Store app package directory 141 | AppPackages/ 142 | 143 | # Others 144 | sql/ 145 | *.Cache 146 | ClientBin/ 147 | [Ss]tyle[Cc]op.* 148 | ~$* 149 | *~ 150 | *.dbmdl 151 | *.dbproj.schemaview 152 | *.pfx 153 | *.publishsettings 154 | node_modules/ 155 | 156 | # RIA/Silverlight projects 157 | Generated_Code/ 158 | 159 | # Backup & report files from converting an old project file to a newer 160 | # Visual Studio version. Backup files are not needed, because we have git ;-) 161 | _UpgradeReport_Files/ 162 | Backup*/ 163 | UpgradeLog*.XML 164 | UpgradeLog*.htm 165 | 166 | # SQL Server files 167 | *.mdf 168 | *.ldf 169 | 170 | # Business Intelligence projects 171 | *.rdl.data 172 | *.bim.layout 173 | *.bim_*.settings 174 | 175 | # Microsoft Fakes 176 | FakesAssemblies/ 177 | 178 | # ========================= 179 | # Operating System Files 180 | # ========================= 181 | 182 | # OSX 183 | # ========================= 184 | 185 | .DS_Store 186 | .AppleDouble 187 | .LSOverride 188 | 189 | # Icon must ends with two \r. 190 | Icon 191 | 192 | # Thumbnails 193 | ._* 194 | 195 | # Files that might appear on external disk 196 | .Spotlight-V100 197 | .Trashes 198 | 199 | # Windows 200 | # ========================= 201 | 202 | # Windows image file caches 203 | Thumbs.db 204 | ehthumbs.db 205 | 206 | # Folder config file 207 | Desktop.ini 208 | 209 | # Recycle Bin used on file shares 210 | $RECYCLE.BIN/ 211 | 212 | # Windows Installer files 213 | *.cab 214 | *.msi 215 | *.msm 216 | *.msp 217 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Trailing Whitespace Visualizer 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/2n9cfl1lups6o7q4?svg=true)](https://ci.appveyor.com/project/madskristensen/trailingwhitespace) 4 | 5 | This extension will highlight and remove any trailing 6 | whitespace on any line in any editor in Visual Studio. 7 | 8 | Download and install the extension from the 9 | [Visual Studio Gallery](http://visualstudiogallery.msdn.microsoft.com/a204e29b-1778-4dae-affd-209bea658a59) 10 | or get the 11 | [nightly build](https://ci.appveyor.com/project/madskristensen/trailingwhitespace/build/artifacts). 12 | 13 | ![C# whitespace](artifacts/CSharp.png) 14 | 15 | ### Remove trailing whitespace 16 | You can very easily delete all the trailing whitespace in a file by executing the **Delete Horizontal White Space** command 17 | found in **Edit** -> **Advanced** or by using the shortcut key combination Ctrl+K, Ctrl+\ 18 | 19 | ### Changing the background color 20 | You can change the background color from the 21 | **Tools -> Options** dialog under the 22 | **Environment -> Fonts and Colors** settings. 23 | 24 | The setting is for the *Text Editor* and the display 25 | item is called *Trailing Whitespace*. 26 | 27 | ![Visual Studio Settings](artifacts/VisualStudioSettings.png) 28 | 29 | ### Ignore rules 30 | It's easy to add specify what file patterns to ignore. Any 31 | ignored file will have whitespace colorized or removed 32 | on save. 33 | 34 | By default, file paths with any of the following strings 35 | contained in it will be ignored: 36 | 37 | - \node_modules\ 38 | - \bower_components\ 39 | - \typings\ 40 | - \lib\ 41 | - .min. 42 | - .md 43 | - .markdown 44 | - .designer. 45 | 46 | You can modify these rules in the **Tools -> Options** dialog. 47 | 48 | ### Remove on save 49 | Every time a file is saved, all trailing whitespace is removed. This can be disabled in the 50 | **Tools -> Options** dialog. 51 | 52 | ![Options dialog](artifacts/OptionsDialog.png) 53 | 54 | ## Contribute 55 | Check out the [contribution guidelines](.github/CONTRIBUTING.md) 56 | if you want to contribute to this project. 57 | 58 | For cloning and building this project yourself, make sure 59 | to install the 60 | [Extensibility Tools 2015](https://visualstudiogallery.msdn.microsoft.com/ab39a092-1343-46e2-b0f1-6a3f91155aa6) 61 | extension for Visual Studio which enables some features 62 | used by this project. 63 | 64 | ## License 65 | [Apache 2.0](LICENSE) -------------------------------------------------------------------------------- /TrailingWhitespace.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28012.3001 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrailingWhitespace", "src\TrailingWhitespace.csproj", "{B1F0ABB6-B033-43A4-81F7-61934474A4CF}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BA4E1407-2A23-47AA-B3E0-24B5980EF712}" 9 | ProjectSection(SolutionItems) = preProject 10 | appveyor.yml = appveyor.yml 11 | README.md = README.md 12 | EndProjectSection 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B1F0ABB6-B033-43A4-81F7-61934474A4CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {B1F0ABB6-B033-43A4-81F7-61934474A4CF}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {B1F0ABB6-B033-43A4-81F7-61934474A4CF}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {B1F0ABB6-B033-43A4-81F7-61934474A4CF}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {0A71D667-5643-4081-98DB-D34326F4B88E} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2019 2 | 3 | install: 4 | - ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex 5 | 6 | before_build: 7 | - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion 8 | - ps: Vsix-TokenReplacement src\source.extension.cs 'Version = "([0-9\\.]+)"' 'Version = "{version}"' 9 | 10 | build_script: 11 | - nuget restore -Verbosity quiet 12 | - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m 13 | 14 | after_test: 15 | - ps: Vsix-PushArtifacts | Vsix-PublishToGallery -------------------------------------------------------------------------------- /artifacts/CSharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/artifacts/CSharp.png -------------------------------------------------------------------------------- /artifacts/OptionsDialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/artifacts/OptionsDialog.png -------------------------------------------------------------------------------- /artifacts/VisualStudioSettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/artifacts/VisualStudioSettings.png -------------------------------------------------------------------------------- /src/Classifier/ClassificationTypes.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.Windows.Media; 3 | using Microsoft.VisualStudio.Text.Classification; 4 | using Microsoft.VisualStudio.Utilities; 5 | 6 | namespace TrailingWhitespace 7 | { 8 | static class TrailingClassificationTypes 9 | { 10 | public const string Whitespace = "TrailingWhitespace"; 11 | 12 | [Export, Name(TrailingClassificationTypes.Whitespace)] 13 | public static ClassificationTypeDefinition TrailingWhitespace { get; set; } 14 | } 15 | 16 | [Export(typeof(EditorFormatDefinition))] 17 | [ClassificationType(ClassificationTypeNames = TrailingClassificationTypes.Whitespace)] 18 | [Name(TrailingClassificationTypes.Whitespace)] 19 | [Order(After = Priority.Default)] 20 | [UserVisible(true)] 21 | sealed class TrailingWhitespaceFormatDefinition : ClassificationFormatDefinition 22 | { 23 | public TrailingWhitespaceFormatDefinition() 24 | { 25 | BackgroundColor = Color.FromRgb(255, 145, 145); 26 | DisplayName = "Trailing Whitespace"; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Classifier/Classifier.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Classifier/Classifier.cs -------------------------------------------------------------------------------- /src/Classifier/ClassifierProvider.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Classifier/ClassifierProvider.cs -------------------------------------------------------------------------------- /src/Commands/RemoveWhitespaceCommand.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Commands/RemoveWhitespaceCommand.cs -------------------------------------------------------------------------------- /src/Commands/RemoveWhitespaceOnSave.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Commands/RemoveWhitespaceOnSave.cs -------------------------------------------------------------------------------- /src/Commands/TextviewCreationListener.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Commands/TextviewCreationListener.cs -------------------------------------------------------------------------------- /src/Commands/WhitespaceBase.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Commands/WhitespaceBase.cs -------------------------------------------------------------------------------- /src/Helpers/FileHelpers.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Helpers/FileHelpers.cs -------------------------------------------------------------------------------- /src/Options.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | using System.ComponentModel; 3 | using System.Collections.Generic; 4 | using System; 5 | 6 | namespace TrailingWhitespace 7 | { 8 | public class Options : DialogPage 9 | { 10 | public Options() 11 | { 12 | RemoveWhitespaceOnSave = true; 13 | IgnorePatterns = @"\node_modules\, \bower_components\, \typings\, \lib\, \Symbols\, .min., .md, .markdown, .designer."; 14 | IgnoreMiscFiles = false; 15 | IgnoreVerbatimString = true; 16 | } 17 | 18 | [Category("General")] 19 | [DisplayName("Remove whitespace on save")] 20 | [Description("Every time a code file is saved, any whitespace is removed first")] 21 | [DefaultValue(true)] 22 | public bool RemoveWhitespaceOnSave { get; set; } 23 | 24 | [Category("General")] 25 | [DisplayName("Ignore pattern")] 26 | [Description("A comma-separated list of strings. Any file containing one of the strings in the path will be ignored.")] 27 | [DefaultValue(@"\node_modules\, \bower_components\, \typings\, \lib\, .min., .md, .markdown, .designer.")] 28 | public string IgnorePatterns { get; set; } 29 | 30 | [Category("General")] 31 | [DisplayName("Ignore misc files")] 32 | [Description("When true, whitespace in files that don't belong to the project will not be shown.")] 33 | [DefaultValue(false)] 34 | public bool IgnoreMiscFiles { get; set; } 35 | 36 | [Category("General")] 37 | [DisplayName("Ignore Verbatim Strings")] 38 | [Description("When true, whitespace in verbatim strings will not be removed.")] 39 | [DefaultValue(true)] 40 | public bool IgnoreVerbatimString { get; set; } 41 | 42 | public IEnumerable GetIgnorePatterns() 43 | { 44 | var raw = IgnorePatterns.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); 45 | 46 | foreach (string pattern in raw) 47 | { 48 | yield return pattern.Trim(); 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using TrailingWhitespace; 4 | 5 | [assembly: AssemblyTitle(Vsix.Name)] 6 | [assembly: AssemblyDescription(Vsix.Description)] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany(Vsix.Author)] 9 | [assembly: AssemblyProduct(Vsix.Name)] 10 | [assembly: AssemblyCopyright(Vsix.Author)] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture(Vsix.Language)] 13 | [assembly: ComVisible(false)] 14 | 15 | [assembly: AssemblyVersion(Vsix.Version)] 16 | [assembly: AssemblyFileVersion(Vsix.Version)] 17 | -------------------------------------------------------------------------------- /src/Resources/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2014 Mads Kristensen 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /src/Resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Resources/logo.png -------------------------------------------------------------------------------- /src/Resources/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/Resources/preview.png -------------------------------------------------------------------------------- /src/TrailingWhitespace.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(VisualStudioVersion) 5 | 6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 7 | Program 8 | v3 9 | $(DevEnvDir)\devenv.exe 10 | /rootsuffix Exp 11 | Normal 12 | true 13 | 14 | 15 | 16 | 17 | 18 | 19 | Debug 20 | AnyCPU 21 | 2.0 22 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 23 | {B1F0ABB6-B033-43A4-81F7-61934474A4CF} 24 | Library 25 | Properties 26 | TrailingWhitespace 27 | TrailingWhitespace 28 | v4.8 29 | true 30 | true 31 | true 32 | true 33 | true 34 | false 35 | 36 | 37 | true 38 | full 39 | false 40 | bin\Debug\ 41 | DEBUG;TRACE 42 | prompt 43 | 4 44 | 45 | 46 | pdbonly 47 | true 48 | bin\Release\ 49 | TRACE 50 | prompt 51 | 4 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Component 62 | 63 | 64 | 65 | 66 | True 67 | True 68 | source.extension.vsixmanifest 69 | 70 | 71 | True 72 | True 73 | VSCommandTable.vsct 74 | 75 | 76 | 77 | 78 | 79 | 80 | Designer 81 | VsixManifestGenerator 82 | source.extension.cs 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | true 99 | 100 | 101 | true 102 | 103 | 104 | true 105 | 106 | 107 | Menus.ctmenu 108 | VsctGenerator 109 | VSCommandTable.cs 110 | 111 | 112 | 113 | 114 | 17.0.32112.339 115 | compile; build; native; contentfiles; analyzers; buildtransitive 116 | 117 | 118 | 17.12.2069 119 | runtime; build; native; contentfiles; analyzers 120 | all 121 | 122 | 123 | 124 | 125 | 132 | -------------------------------------------------------------------------------- /src/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace TrailingWhitespace 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string guidVSPackageString = "043286da-34d9-44a7-93eb-16a775cfcf61"; 16 | public static Guid guidVSPackage = new Guid(guidVSPackageString); 17 | 18 | public const string guidVSPackageCmdSetString = "3ff85586-1fd8-4018-a861-5012505d6f3a"; 19 | public static Guid guidVSPackageCmdSet = new Guid(guidVSPackageCmdSetString); 20 | } 21 | /// 22 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 23 | /// 24 | internal sealed partial class PackageIds 25 | { 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /src/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/VSPackage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/TrailingWhitespace/f49005283b99ff992ce9d223e9cb49b095622925/src/VSPackage.cs -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace TrailingWhitespace 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "dac582ef-fc73-42f6-ad45-afaad93d88a4"; 11 | public const string Name = "Trailing Whitespace Visualizer"; 12 | public const string Description = @"Keeps your code files clean by making it easier than ever to identify and remove any trailing whitespace"; 13 | public const string Language = "en-US"; 14 | public const string Version = "2.6"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = "whitespace"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Trailing Whitespace Visualizer 6 | Keeps your code files clean by making it easier than ever to identify and remove any trailing whitespace 7 | https://visualstudiogallery.msdn.microsoft.com/a204e29b-1778-4dae-affd-209bea658a59 8 | Resources\License.txt 9 | Resources\logo.png 10 | Resources\preview.png 11 | whitespace 12 | 13 | 14 | 15 | amd64 16 | 17 | 18 | arm64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | --------------------------------------------------------------------------------