├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── LinePress.sln ├── LinePress ├── Key.snk ├── LinePress.csproj ├── LinePressPackage.cs ├── LineTransformation │ ├── LinePressTransformSource.cs │ └── LinePressTransformSourceProvider.cs ├── Options │ ├── Infrastructure │ │ ├── ISettings.cs │ │ ├── RelayCommand.cs │ │ ├── SettingAttribute.cs │ │ ├── SettingsStore.cs │ │ └── StringExtensions.cs │ ├── LinePressSettings.cs │ ├── OptionsPage.cs │ ├── OptionsPageControl.xaml │ └── OptionsPageControl.xaml.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Icon.png │ └── PreviewImage.png ├── app.config ├── packages.config ├── source.extension.cs ├── source.extension.ico ├── source.extension.resx └── source.extension.vsixmanifest ├── README.md ├── appveyor.yml └── screenshots ├── Settings.png └── compare.gif /.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 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Microsoft Azure ApplicationInsights config file 170 | ApplicationInsights.config 171 | 172 | # Windows Store app package directory 173 | AppPackages/ 174 | BundleArtifacts/ 175 | 176 | # Visual Studio cache files 177 | # files ending in .cache can be ignored 178 | *.[Cc]ache 179 | # but keep track of directories ending in .cache 180 | !*.[Cc]ache/ 181 | 182 | # Others 183 | ClientBin/ 184 | [Ss]tyle[Cc]op.* 185 | ~$* 186 | *~ 187 | *.dbmdl 188 | *.dbproj.schemaview 189 | *.pfx 190 | *.publishsettings 191 | node_modules/ 192 | orleans.codegen.cs 193 | 194 | # RIA/Silverlight projects 195 | Generated_Code/ 196 | 197 | # Backup & report files from converting an old project file 198 | # to a newer Visual Studio version. Backup files are not needed, 199 | # because we have git ;-) 200 | _UpgradeReport_Files/ 201 | Backup*/ 202 | UpgradeLog*.XML 203 | UpgradeLog*.htm 204 | 205 | # SQL Server files 206 | *.mdf 207 | *.ldf 208 | 209 | # Business Intelligence projects 210 | *.rdl.data 211 | *.bim.layout 212 | *.bim_*.settings 213 | 214 | # Microsoft Fakes 215 | FakesAssemblies/ 216 | 217 | # GhostDoc plugin setting file 218 | *.GhostDoc.xml 219 | 220 | # Node.js Tools for Visual Studio 221 | .ntvs_analysis.dat 222 | 223 | # Visual Studio 6 build log 224 | *.plg 225 | 226 | # Visual Studio 6 workspace options file 227 | *.opt 228 | 229 | # Visual Studio LightSwitch build output 230 | **/*.HTMLClient/GeneratedArtifacts 231 | **/*.DesktopClient/GeneratedArtifacts 232 | **/*.DesktopClient/ModelManifest.xml 233 | **/*.Server/GeneratedArtifacts 234 | **/*.Server/ModelManifest.xml 235 | _Pvt_Extensions 236 | 237 | # LightSwitch generated files 238 | GeneratedArtifacts/ 239 | ModelManifest.xml 240 | 241 | # Paket dependency manager 242 | .paket/paket.exe 243 | 244 | # FAKE - F# Make 245 | .fake/ 246 | /LinePress/Options/Infrastructure 247 | /LinePress/Options/LinePressSettings.cs 248 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ##Changelog 3 | 4 | ### 2.3 5 | 6 | **2017-09-22 7 | 8 | - [x] Add the ability to increase line-height of uncompressed lines. 9 | 10 | ### 2.2 11 | 12 | **2017-05-13 13 | 14 | - [x] Sleek UI. 15 | 16 | ### 2.0 17 | 18 | **2017-05-10 19 | 20 | - [x] Add the ability to compress lines with a given content. 21 | 22 | ### 1.1 23 | 24 | **2017-05-7 25 | 26 | - [x] Revamped the settings management code. 27 | 28 | ### 1.0 29 | 30 | **2017-04-3 31 | 32 | - [x] Initial release. 33 | - [x] Compress empty lines. 34 | - [x] Compress lines that contains nothing but curly braces. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 Omar Rwemi 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. -------------------------------------------------------------------------------- /LinePress.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.9 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinePress", "LinePress\LinePress.csproj", "{E6C624CB-7358-4D93-B9CA-DAAD3DDEE9FF}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C14B5017-A0C3-4363-893A-5057A0800584}" 9 | ProjectSection(SolutionItems) = preProject 10 | appveyor.yml = appveyor.yml 11 | CHANGELOG.md = CHANGELOG.md 12 | README.md = README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {E6C624CB-7358-4D93-B9CA-DAAD3DDEE9FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {E6C624CB-7358-4D93-B9CA-DAAD3DDEE9FF}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {E6C624CB-7358-4D93-B9CA-DAAD3DDEE9FF}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {E6C624CB-7358-4D93-B9CA-DAAD3DDEE9FF}.Release|Any CPU.Build.0 = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /LinePress/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omsharp/LinePress/20a41b41c9b1830e3872255d3f1f4441bb906615/LinePress/Key.snk -------------------------------------------------------------------------------- /LinePress/LinePress.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 15.0 6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 7 | 8 | 9 | true 10 | 11 | 12 | true 13 | 14 | 15 | Key.snk 16 | 17 | 18 | 19 | Debug 20 | AnyCPU 21 | 2.0 22 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 23 | {E6C624CB-7358-4D93-B9CA-DAAD3DDEE9FF} 24 | Library 25 | Properties 26 | LinePress 27 | LinePress 28 | v4.6 29 | 30 | Program 31 | $(DevEnvDir)\devenv.exe 32 | /rootsuffix Exp 33 | 34 | true 35 | true 36 | true 37 | true 38 | true 39 | false 40 | 41 | 42 | true 43 | full 44 | false 45 | bin\Debug\ 46 | DEBUG;TRACE 47 | prompt 48 | 4 49 | default 50 | 51 | 52 | pdbonly 53 | true 54 | bin\Release\ 55 | TRACE 56 | prompt 57 | 4 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Component 66 | 67 | 68 | OptionsPageControl.xaml 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | source.extension.vsixmanifest 78 | 79 | 80 | 81 | 82 | Resources\LICENSE 83 | true 84 | 85 | 86 | 87 | 88 | 89 | Designer 90 | VsixManifestGenerator 91 | source.extension.resx 92 | 93 | 94 | 95 | 96 | ..\packages\Microsoft.VisualStudio.CoreUtility.14.3.25407\lib\net45\Microsoft.VisualStudio.CoreUtility.dll 97 | 98 | 99 | ..\packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll 100 | True 101 | 102 | 103 | ..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll 104 | True 105 | 106 | 107 | ..\packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll 108 | True 109 | 110 | 111 | ..\packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll 112 | True 113 | 114 | 115 | ..\packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll 116 | True 117 | 118 | 119 | ..\packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll 120 | True 121 | 122 | 123 | ..\packages\Microsoft.VisualStudio.Text.Data.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.Data.dll 124 | 125 | 126 | ..\packages\Microsoft.VisualStudio.Text.Logic.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.Logic.dll 127 | 128 | 129 | ..\packages\Microsoft.VisualStudio.Text.UI.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.UI.dll 130 | 131 | 132 | ..\packages\Microsoft.VisualStudio.Text.UI.Wpf.14.0.23205\lib\net45\Microsoft.VisualStudio.Text.UI.Wpf.dll 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | True 145 | True 146 | source.extension.vsixmanifest 147 | true 148 | VSPackage 149 | 150 | 151 | 152 | 153 | Designer 154 | MSBuild:Compile 155 | 156 | 157 | 158 | 159 | Always 160 | true 161 | 162 | 163 | Always 164 | true 165 | 166 | 167 | source.extension.vsixmanifest 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 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}. 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 195 | -------------------------------------------------------------------------------- /LinePress/LinePressPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | using LinePress.Options; 6 | using System.Windows; 7 | 8 | namespace LinePress 9 | { 10 | [ProvideOptionPage(typeof(OptionsPage), "Line Press", "Options", 0, 0, true)] 11 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading =true)] 12 | [InstalledProductRegistration("#110", "#112", Vsix.Id, IconResourceID = 400)] 13 | [Guid(PackageGuidString)] 14 | [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", 15 | Justification = "pkgdef, VS and vsixmanifest are valid VS terms")] 16 | public sealed class LinePressPackage : AsyncPackage 17 | { 18 | public const string PackageGuidString = "0267e91e-033e-4dbc-9f41-0efe67f515ae"; 19 | } 20 | } -------------------------------------------------------------------------------- /LinePress/LineTransformation/LinePressTransformSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using LinePress.Options; 4 | using Microsoft.VisualStudio.Text.Editor; 5 | using Microsoft.VisualStudio.Text.Formatting; 6 | 7 | namespace LinePress 8 | { 9 | public class LinePressTransformSource : ILineTransformSource 10 | { 11 | private readonly LineTransform defaultTransform = new LineTransform(0d, 0d, 1d); 12 | 13 | private LineTransform emptyLineTransform; 14 | private LineTransform customTokensTransform; 15 | private LineTransform lineSpacingTransform; 16 | 17 | private readonly IWpfTextView textView; 18 | private readonly LinePressSettings settings = new LinePressSettings(); 19 | 20 | private LinePressTransformSource(IWpfTextView view) 21 | { 22 | textView = view; 23 | SettingsStore.LoadSettings(settings); 24 | SettingsStore.SettingsChanged += OnSettingsChanged; 25 | SetTransforms(); 26 | } 27 | 28 | public static LinePressTransformSource Create(IWpfTextView view) 29 | { 30 | return view.Properties.GetOrCreateSingletonProperty(() => new LinePressTransformSource(view)); 31 | } 32 | 33 | public LineTransform GetLineTransform(ITextViewLine line, double yPosition, ViewRelativePosition placement) 34 | { 35 | var lineText = line.Snapshot.GetText(line.Start, line.Length).Trim(); 36 | 37 | if (IsComment(lineText)) 38 | return settings.ApplySpacingToComments ? lineSpacingTransform : defaultTransform; 39 | 40 | if (IsLongOrWrapped(line)) 41 | return lineSpacingTransform; 42 | 43 | if (settings.CompressEmptyLines && string.IsNullOrWhiteSpace(lineText)) 44 | return emptyLineTransform; 45 | 46 | if (settings.CompressCustomTokens && settings.CustomTokens.Contains(lineText)) 47 | return customTokensTransform; 48 | 49 | return lineSpacingTransform; 50 | } 51 | 52 | private bool IsComment(string codeLine) => Regex.Match(codeLine, @"^\/\/.*").Success; 53 | 54 | private bool IsLongOrWrapped(ITextViewLine line) => line.Length > 100 55 | || !line.IsFirstTextViewLineForSnapshotLine 56 | || !line.IsLastTextViewLineForSnapshotLine 57 | || line.End > line.Start.GetContainingLine().End; 58 | 59 | private double CustomTokensScale => (100d - settings.CustomTokensScale) / 100d; 60 | 61 | private double EmptyLineScale => (100d - settings.EmptyLineScale) / 100d; 62 | 63 | private void SetTransforms() 64 | { 65 | var lineHeight = textView?.TextViewLines?.FirstVisibleLine?.TextHeight ?? 10d; 66 | var lineSpacing = (double)settings.LineSpacingPercent; 67 | var pixelSpace = settings.LineSpacingPercent != 0 ? Math.Round(lineHeight * lineSpacing / 200d) : 0d; 68 | 69 | lineSpacingTransform = new LineTransform(pixelSpace, pixelSpace, 1d); 70 | emptyLineTransform = new LineTransform(0d, 0d, EmptyLineScale); 71 | customTokensTransform = new LineTransform(0d, 0d, CustomTokensScale); 72 | } 73 | 74 | private void OnSettingsChanged() 75 | { 76 | SettingsStore.LoadSettings(settings); 77 | 78 | SetTransforms(); 79 | 80 | var firstLine = textView.TextViewLines.FirstVisibleLine; 81 | 82 | textView.DisplayTextLineContainingBufferPosition(firstLine.Start, 83 | firstLine.Top - textView.ViewportTop, 84 | ViewRelativePosition.Top); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /LinePress/LineTransformation/LinePressTransformSourceProvider.cs: -------------------------------------------------------------------------------- 1 |  2 | using Microsoft.VisualStudio.Text.Differencing; 3 | using Microsoft.VisualStudio.Text.Editor; 4 | using Microsoft.VisualStudio.Text.Formatting; 5 | using Microsoft.VisualStudio.Utilities; 6 | using System.ComponentModel.Composition; 7 | 8 | namespace LinePress 9 | { 10 | [Export(typeof(ILineTransformSourceProvider))] 11 | [ContentType("text")] 12 | [TextViewRole(PredefinedTextViewRoles.Document)] 13 | [TextViewRole(PredefinedTextViewRoles.EmbeddedPeekTextView)] 14 | [TextViewRole(PredefinedTextViewRoles.PreviewTextView)] 15 | [TextViewRole(PredefinedTextViewRoles.Interactive)] 16 | [TextViewRole("PRINTABLE")] 17 | internal class LinePressTransformSourceProvider : ILineTransformSourceProvider 18 | { 19 | public ILineTransformSource Create(IWpfTextView textView) 20 | { 21 | if (textView.Roles.Contains(DifferenceViewerRoles.LeftViewTextViewRole) 22 | || textView.Roles.Contains(DifferenceViewerRoles.RightViewTextViewRole) 23 | || textView.Roles.Contains("VSMERGEDEFAULT")) 24 | { 25 | //! Ignore diff views 26 | return null; 27 | } 28 | 29 | return LinePressTransformSource.Create(textView); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LinePress/Options/Infrastructure/ISettings.cs: -------------------------------------------------------------------------------- 1 | namespace LinePress.Options 2 | { 3 | public interface ISettings 4 | { 5 | string Key { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /LinePress/Options/Infrastructure/RelayCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace LinePress.Options 5 | { 6 | public class RelayCommand : ICommand 7 | { 8 | private Predicate canExecute; 9 | private Action execute; 10 | 11 | public RelayCommand(Predicate canExecute, Action execute) 12 | { 13 | this.canExecute = canExecute; 14 | this.execute = execute; 15 | } 16 | 17 | public event EventHandler CanExecuteChanged 18 | { 19 | add 20 | { 21 | if (canExecute != null) 22 | CommandManager.RequerySuggested += value; 23 | } 24 | remove 25 | { 26 | if (canExecute != null) 27 | CommandManager.RequerySuggested -= value; 28 | } 29 | } 30 | 31 | public bool CanExecute(object parameter) 32 | { 33 | return canExecute((T)parameter); 34 | } 35 | 36 | public void Execute(object parameter) 37 | { 38 | execute((T)parameter); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LinePress/Options/Infrastructure/SettingAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LinePress.Options 4 | { 5 | public class SettingAttribute : Attribute 6 | { } 7 | } -------------------------------------------------------------------------------- /LinePress/Options/Infrastructure/SettingsStore.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using Microsoft.VisualStudio.Settings; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Shell.Settings; 6 | using System.Linq; 7 | using System.Collections.Generic; 8 | using System.Reflection; 9 | 10 | namespace LinePress.Options 11 | { 12 | public static class SettingsStore 13 | { 14 | private static readonly WritableSettingsStore store 15 | = new ShellSettingsManager(ServiceProvider.GlobalProvider).GetWritableSettingsStore(SettingsScope.UserSettings); 16 | 17 | public static event Action SettingsChanged; 18 | 19 | public static void SaveSettings(ISettings settings) 20 | { 21 | try 22 | { 23 | if (!store.CollectionExists(settings.Key)) 24 | store.CreateCollection(settings.Key); 25 | 26 | if (SaveSettingsIntoStore(settings)) 27 | SettingsChanged?.Invoke(); 28 | } 29 | catch (Exception ex) 30 | { 31 | Debug.Fail(ex.Message); 32 | } 33 | } 34 | 35 | public static void LoadSettings(ISettings settings) 36 | { 37 | try 38 | { 39 | if (store.CollectionExists(settings.Key)) 40 | LoadSettingsFromStore(settings); 41 | } 42 | catch (Exception ex) 43 | { 44 | Debug.Fail(ex.Message); 45 | } 46 | } 47 | 48 | private static bool SaveSettingsIntoStore(ISettings settings) 49 | { 50 | var isSaved = false; 51 | 52 | foreach (var prop in GetProperties(settings)) 53 | { 54 | switch (prop.GetValue(settings)) 55 | { 56 | case bool b: 57 | store.SetBoolean(settings.Key, prop.Name, b); 58 | isSaved = true; 59 | break; 60 | 61 | case int i: 62 | store.SetInt32(settings.Key, prop.Name, i); 63 | isSaved = true; 64 | break; 65 | 66 | case double d: 67 | store.SetString(settings.Key, prop.Name, d.ToString()); 68 | isSaved = true; 69 | break; 70 | 71 | case string s: 72 | store.SetString(settings.Key, prop.Name, s); 73 | isSaved = true; 74 | break; 75 | } 76 | } 77 | 78 | return isSaved; 79 | } 80 | 81 | private static void LoadSettingsFromStore(ISettings settings) 82 | { 83 | foreach (var prop in GetProperties(settings)) 84 | { 85 | if (store.PropertyExists(settings.Key, prop.Name)) 86 | { 87 | switch (prop.GetValue(settings)) 88 | { 89 | case bool b: 90 | prop.SetValue(settings, store.GetBoolean(settings.Key, prop.Name)); 91 | break; 92 | 93 | case int i: 94 | prop.SetValue(settings, store.GetInt32(settings.Key, prop.Name)); 95 | break; 96 | 97 | case double d when double.TryParse(store.GetString(settings.Key, prop.Name), out double value): 98 | prop.SetValue(settings, value); 99 | break; 100 | 101 | case string s: 102 | prop.SetValue(settings, store.GetString(settings.Key, prop.Name)); 103 | break; 104 | } 105 | } 106 | } 107 | } 108 | 109 | private static IEnumerable GetProperties(ISettings settings) 110 | { 111 | return settings.GetType() 112 | .GetProperties() 113 | .Where(p => Attribute.IsDefined(p, typeof(SettingAttribute))); 114 | } 115 | } 116 | } -------------------------------------------------------------------------------- /LinePress/Options/Infrastructure/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace LinePress.Options 2 | { 3 | public static class StringExtensions 4 | { 5 | public static bool IsNullOrWhiteSpace(this string source) 6 | => string.IsNullOrWhiteSpace(source); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /LinePress/Options/LinePressSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | using System.Text; 4 | using System.Collections.ObjectModel; 5 | using System.Collections.Generic; 6 | using System; 7 | 8 | namespace LinePress.Options 9 | { 10 | public class LinePressSettings : ISettings, INotifyPropertyChanged 11 | { 12 | #region Fields 13 | 14 | private bool compressEmptyLines = true; 15 | private bool compressCustomTokens = true; 16 | 17 | private int emptyLineScale = 50; 18 | private int customTokensScale = 25; 19 | 20 | private int lineSpacingPercent = 0; 21 | private bool applySpacingToComments = false; 22 | 23 | private ObservableCollection customTokens 24 | = new ObservableCollection { "{", "}" }; 25 | 26 | #endregion 27 | 28 | #region Events 29 | 30 | public event Action TokenAdded; 31 | 32 | #endregion 33 | 34 | #region Constructors 35 | 36 | public LinePressSettings() 37 | { 38 | InsertTokenCommand = new RelayCommand(CanInsertToken, t => 39 | { 40 | CustomTokens.Add(t); 41 | TokenAdded?.Invoke(); 42 | }); 43 | 44 | DeleteTokenCommand = new RelayCommand(CanDeleteToken, t => CustomTokens.Remove(t)); 45 | } 46 | 47 | #endregion 48 | 49 | #region Settings Properties 50 | 51 | [Setting] 52 | public bool CompressEmptyLines 53 | { 54 | get { return compressEmptyLines; } 55 | set { SetField(ref compressEmptyLines, value); } 56 | } 57 | 58 | [Setting] 59 | public int EmptyLineScale 60 | { 61 | get { return emptyLineScale; } 62 | set { SetField(ref emptyLineScale, value); } 63 | } 64 | 65 | [Setting] 66 | public bool CompressCustomTokens 67 | { 68 | get { return compressCustomTokens; } 69 | set { SetField(ref compressCustomTokens, value); } 70 | } 71 | 72 | [Setting] 73 | public int CustomTokensScale 74 | { 75 | get { return customTokensScale; } 76 | set { SetField(ref customTokensScale, value); } 77 | } 78 | 79 | [Setting] 80 | public string CustomTokensString 81 | { 82 | get { return ConvertTokensListToString(); } 83 | set { BuildTokensListFromString(value); } 84 | } 85 | 86 | [Setting] 87 | public int LineSpacingPercent 88 | { 89 | get { return lineSpacingPercent; } 90 | set { SetField(ref lineSpacingPercent, value); } 91 | } 92 | 93 | [Setting] 94 | public bool ApplySpacingToComments 95 | { 96 | get { return applySpacingToComments; } 97 | set { SetField(ref applySpacingToComments, value); } 98 | } 99 | 100 | #endregion 101 | 102 | #region Non-Settings Properties 103 | 104 | public ObservableCollection CustomTokens => customTokens; 105 | 106 | #endregion 107 | 108 | #region Commands 109 | 110 | public RelayCommand InsertTokenCommand { get; private set; } 111 | public RelayCommand DeleteTokenCommand { get; private set; } 112 | 113 | private bool CanInsertToken(string token) => 114 | !token.IsNullOrWhiteSpace() && !CustomTokens.Contains(token); 115 | 116 | private bool CanDeleteToken(string token) => 117 | !token.IsNullOrWhiteSpace() && CustomTokens.Contains(token); 118 | 119 | #endregion 120 | 121 | #region Helpers 122 | 123 | private void BuildTokensListFromString(string str) 124 | { 125 | customTokens.Clear(); 126 | var tokens = str.Split(null); 127 | foreach (var token in tokens) 128 | customTokens.Add(token); 129 | } 130 | 131 | private string ConvertTokensListToString() 132 | { 133 | var stringBuilder = new StringBuilder(customTokens[0]); 134 | 135 | for (var i = 1; i < customTokens.Count; i++) 136 | { 137 | stringBuilder.Append(' '); 138 | stringBuilder.Append(customTokens[i]); 139 | } 140 | 141 | return stringBuilder.ToString(); 142 | } 143 | 144 | #endregion 145 | 146 | #region ISettings Members 147 | 148 | public string Key => "LinePress"; 149 | 150 | #endregion 151 | 152 | #region INotifyPropertyChanged Members 153 | 154 | public event PropertyChangedEventHandler PropertyChanged; 155 | 156 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) 157 | { 158 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 159 | } 160 | 161 | private void SetField(ref T field, T value, [CallerMemberName] string propertyName = null) 162 | { 163 | if (EqualityComparer.Default.Equals(field, value)) 164 | return; 165 | 166 | field = value; 167 | 168 | OnPropertyChanged(propertyName); 169 | } 170 | #endregion 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /LinePress/Options/OptionsPage.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System.Windows; 3 | using Microsoft.VisualStudio.Shell; 4 | using System.ComponentModel; 5 | using System; 6 | 7 | namespace LinePress.Options 8 | { 9 | [ClassInterface(ClassInterfaceType.AutoDual)] 10 | [ComVisible(true)] 11 | [Guid("e137d6a4-53b9-4995-bb49-bbbb20088b48")] 12 | public class OptionsPage : UIElementDialogPage 13 | { 14 | private OptionsPageControl pageControl; 15 | 16 | protected override UIElement Child 17 | { 18 | get { return pageControl ?? (pageControl = new OptionsPageControl()); } 19 | } 20 | 21 | protected override void OnActivate(CancelEventArgs e) 22 | { 23 | SettingsStore.LoadSettings(pageControl.Settings); 24 | 25 | base.OnActivate(e); 26 | } 27 | 28 | protected override void OnApply(PageApplyEventArgs e) 29 | { 30 | if (e.ApplyBehavior == ApplyKind.Apply) 31 | SettingsStore.SaveSettings(pageControl.Settings); 32 | 33 | base.OnApply(e); 34 | } 35 | 36 | protected override void OnClosed(EventArgs e) 37 | { 38 | pageControl.Clear(); 39 | 40 | base.OnClosed(e); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /LinePress/Options/OptionsPageControl.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 147 | 148 | 149 | 169 | 170 | 171 | 194 | 195 | 196 | 215 | 216 | 217 | 218 | 219 | 223 | 226 | 227 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 267 | 268 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 330 | 331 | 332 | 335 | 336 | 339 | 340 | 341 | 344 | 354 | 355 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 384 | 385 | 386 | 389 | 390 | 393 | 394 | 395 | 401 | 402 | 403 | 404 | 408 | 418 | 419 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 441 | 442 | 443 | 446 | 447 | 450 | 451 | 452 | 459 | 460 | 461 | 462 | 467 | 468 | 469 |