├── EncouragePackage ├── Key.snk ├── Resources │ └── Package.ico ├── IEncouragements.cs ├── Guids.cs ├── GlobalSuppressions.cs ├── Encouragements.cs ├── EncourageSignatureHelpSourceProvider.cs ├── EncourageIntellisenseControllerProvider.cs ├── Properties │ └── AssemblyInfo.cs ├── source.extension.vsixmanifest ├── EncourageIntellisenseController.cs ├── EncouragePackage.cs ├── Resources.Designer.cs ├── EncourageSignatureHelpSource.cs ├── Resources.resx ├── VSPackage.resx └── EncouragePackage.csproj ├── .gitattributes ├── README.md ├── LICENSE.txt ├── Encourage.sln ├── .gitignore └── Encourage.sln.DotSettings /EncouragePackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/Encourage/master/EncouragePackage/Key.snk -------------------------------------------------------------------------------- /EncouragePackage/Resources/Package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/Encourage/master/EncouragePackage/Resources/Package.ico -------------------------------------------------------------------------------- /EncouragePackage/IEncouragements.cs: -------------------------------------------------------------------------------- 1 | namespace Haack.Encourage 2 | { 3 | public interface IEncouragements 4 | { 5 | string GetRandomEncouragement(); 6 | } 7 | } -------------------------------------------------------------------------------- /EncouragePackage/Guids.cs: -------------------------------------------------------------------------------- 1 | // Guids.cs 2 | // MUST match guids.h 3 | using System; 4 | 5 | namespace Haack.Encourage 6 | { 7 | static class GuidList 8 | { 9 | public const string guidEncouragePackagePkgString = "f38d29e7-cd86-43d5-9c32-4be26302b55e"; 10 | public const string guidEncouragePackageCmdSetString = "dfa60510-4edb-4142-8b57-824615d11ada"; 11 | 12 | public static readonly Guid guidEncouragePackageCmdSet = new Guid(guidEncouragePackageCmdSetString); 13 | }; 14 | } -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /EncouragePackage/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. Project-level 3 | // suppressions either have no target or are given a specific target 4 | // and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click "In Project 8 | // Suppression File". You do not need to add suppressions to this 9 | // file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] 12 | -------------------------------------------------------------------------------- /EncouragePackage/Encouragements.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | 5 | namespace Haack.Encourage 6 | { 7 | [Export(typeof(IEncouragements))] 8 | public class Encouragements : IEncouragements 9 | { 10 | static readonly Random random = new Random(); 11 | readonly List encouragements = new List 12 | { 13 | "Nice Job!", 14 | "Way to go!", 15 | "Wow, nice change!", 16 | "So good!" 17 | }; 18 | 19 | public string GetRandomEncouragement() 20 | { 21 | int randomIndex = random.Next(0, encouragements.Count - 1); 22 | return encouragements[randomIndex]; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Encourage 2 | 3 | ## What is it? 4 | 5 | A whimsical extension to Visual Studio that adds just a little bit of encouragement throughout your day. 6 | 7 | Every time you save your document, this extension gives you an unobtrusive bit of good cheer and encouragement. 8 | 9 | ![encouragement light](https://cloud.githubusercontent.com/assets/19977/3343412/5e5b933a-f89f-11e3-8c2b-21277dcd19e1.png) 10 | 11 | ## Install It 12 | 13 | [Install it from the Visual Studio Extension Gallery](http://visualstudiogallery.msdn.microsoft.com/1f3afebb-06c7-4b77-a54f-eb2f0784008d) 14 | 15 | ## Credit 16 | 17 | All credit for the idea goes to [Pat Nakajima](http://patnakajima.com/) who wrote Encourage for TextMate in about a line of code. For Visual Studio, it takes a LOT MORE THAN THAT! 18 | Also thanks to @jaredpar for his help. 19 | 20 | ## License 21 | 22 | [MIT](LICENSE.txt) -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 Phil Haack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /EncouragePackage/EncourageSignatureHelpSourceProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Text; 4 | using Microsoft.VisualStudio.Text.Operations; 5 | using Microsoft.VisualStudio.Utilities; 6 | 7 | namespace Haack.Encourage 8 | { 9 | [Export(typeof(ISignatureHelpSourceProvider))] 10 | [Name("ToolTip SignatureHelp Source")] 11 | [Order(Before = "Default Signature Help Presenter")] 12 | [ContentType("text")] 13 | internal class EncourageSignatureHelpSourceProvider : ISignatureHelpSourceProvider 14 | { 15 | [Import] 16 | internal ITextStructureNavigatorSelectorService NavigatorService { get; set; } 17 | 18 | [Import] 19 | internal ITextBufferFactoryService TextBufferFactoryService { get; set; } 20 | 21 | [Import] 22 | internal IEncouragements Encouragements { get; set; } 23 | 24 | public ISignatureHelpSource TryCreateSignatureHelpSource(ITextBuffer textBuffer) 25 | { 26 | return new EncourageSignatureHelpSource(textBuffer, Encouragements); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /EncouragePackage/EncourageIntellisenseControllerProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using EnvDTE; 4 | using Microsoft.VisualStudio.Language.Intellisense; 5 | using Microsoft.VisualStudio.Shell; 6 | using Microsoft.VisualStudio.Text; 7 | using Microsoft.VisualStudio.Text.Editor; 8 | using Microsoft.VisualStudio.Utilities; 9 | 10 | namespace Haack.Encourage 11 | { 12 | [Export(typeof(IIntellisenseControllerProvider))] 13 | [Name("Encourage Intellisense Controller")] 14 | [ContentType("text")] 15 | internal class EncourageIntellisenseControllerProvider : IIntellisenseControllerProvider 16 | { 17 | [Import] 18 | internal ISignatureHelpBroker SignatureHelpBroker { get; set; } 19 | 20 | [Import] 21 | internal SVsServiceProvider ServiceProvider = null; 22 | 23 | public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList subjectBuffers) 24 | { 25 | var dte = (DTE)ServiceProvider.GetService(typeof(DTE)); 26 | return new EncourageIntellisenseController(textView, dte, this); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /EncouragePackage/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Resources; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Encourage")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("HaackAttack Enterprises")] 14 | [assembly: AssemblyProduct("Encourage")] 15 | [assembly: AssemblyCopyright("")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | [assembly: ComVisible(false)] 19 | [assembly: CLSCompliant(false)] 20 | [assembly: NeutralResourcesLanguage("en-US")] 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 Revision and Build Numbers 30 | // by using the '*' as shown below: 31 | 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Encourage.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EncouragePackage", "EncouragePackage\EncouragePackage.csproj", "{4A77FC23-A472-47C8-93B5-F59691F53201}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{A84D9A09-F54D-4723-BECD-42E9AD5807EA}" 9 | ProjectSection(SolutionItems) = preProject 10 | LICENSE.txt = LICENSE.txt 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {4A77FC23-A472-47C8-93B5-F59691F53201}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {4A77FC23-A472-47C8-93B5-F59691F53201}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {4A77FC23-A472-47C8-93B5-F59691F53201}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {4A77FC23-A472-47C8-93B5-F59691F53201}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /EncouragePackage/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Encourage 6 | Adds a bit of whimsy to your work day. 7 | LICENSE.txt 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /EncouragePackage/EncourageIntellisenseController.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Text; 4 | using Microsoft.VisualStudio.Text.Editor; 5 | 6 | namespace Haack.Encourage 7 | { 8 | internal class EncourageIntellisenseController : IIntellisenseController 9 | { 10 | ITextView textView; 11 | readonly EncourageIntellisenseControllerProvider provider; 12 | ISignatureHelpSession session; 13 | DocumentEvents documentEvents; 14 | 15 | public EncourageIntellisenseController( 16 | ITextView textView, 17 | DTE dte, 18 | EncourageIntellisenseControllerProvider provider) 19 | { 20 | this.textView = textView; 21 | this.provider = provider; 22 | this.documentEvents = dte.Events.DocumentEvents; 23 | documentEvents.DocumentSaved += OnSaved; 24 | } 25 | 26 | void OnSaved(Document document) 27 | { 28 | var point = textView.Caret.Position.BufferPosition; 29 | var triggerPoint = point.Snapshot.CreateTrackingPoint(point.Position, PointTrackingMode.Positive); 30 | if (!provider.SignatureHelpBroker.IsSignatureHelpActive(textView)) 31 | { 32 | session = provider.SignatureHelpBroker.TriggerSignatureHelp(textView, triggerPoint, true); 33 | } 34 | } 35 | 36 | public void Detach(ITextView detacedTextView) 37 | { 38 | if (textView == detacedTextView) 39 | { 40 | textView = null; 41 | } 42 | } 43 | 44 | public void ConnectSubjectBuffer(ITextBuffer subjectBuffer) 45 | { 46 | } 47 | 48 | public void DisconnectSubjectBuffer(ITextBuffer subjectBuffer) 49 | { 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /EncouragePackage/EncouragePackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.Shell; 5 | 6 | namespace Haack.Encourage 7 | { 8 | /// 9 | /// This is the class that implements the package exposed by this assembly. 10 | /// 11 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 12 | /// is to implement the IVsPackage interface and register itself with the shell. 13 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 14 | /// to do it: it derives from the Package class that provides the implementation of the 15 | /// IVsPackage interface and uses the registration attributes defined in the framework to 16 | /// register itself and its components with the shell. 17 | /// 18 | // This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is 19 | // a package. 20 | [PackageRegistration(UseManagedResourcesOnly = true)] 21 | // This attribute is used to register the information needed to show this package 22 | // in the Help/About dialog of Visual Studio. 23 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] 24 | [Guid(GuidList.guidEncouragePackagePkgString)] 25 | public sealed class EncouragePackage : Package 26 | { 27 | /// 28 | /// Default constructor of the package. 29 | /// Inside this method you can place any initialization code that does not require 30 | /// any Visual Studio service because at this point the package object is created but 31 | /// not sited yet inside Visual Studio environment. The place to do all the other 32 | /// initialization is the Initialize method. 33 | /// 34 | public EncouragePackage() 35 | { 36 | Debug.WriteLine("Entering constructor for: {0}", this); 37 | } 38 | 39 | ///////////////////////////////////////////////////////////////////////////// 40 | // Overridden Package Implementation 41 | 42 | /// 43 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 44 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 45 | /// 46 | protected override void Initialize() 47 | { 48 | Debug.WriteLine("Entering Initialize() of: {0}", this); 49 | base.Initialize(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /EncouragePackage/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Haack.Encourage { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Haack.Encourage.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /EncouragePackage/EncourageSignatureHelpSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using Microsoft.VisualStudio.Language.Intellisense; 5 | using Microsoft.VisualStudio.Text; 6 | 7 | namespace Haack.Encourage 8 | { 9 | internal class EncourageSignatureHelpSource : ISignatureHelpSource 10 | { 11 | sealed class Signature : ISignature 12 | { 13 | readonly ITrackingSpan trackingSpan; 14 | readonly string content; 15 | readonly string prettyPrintedContent; 16 | readonly string documentation; 17 | 18 | public ITrackingSpan ApplicableToSpan 19 | { 20 | get { return this.trackingSpan; } 21 | } 22 | 23 | public string Content 24 | { 25 | get { return this.content; } 26 | } 27 | 28 | public IParameter CurrentParameter 29 | { 30 | get { return null; } 31 | } 32 | 33 | public event EventHandler CurrentParameterChanged; 34 | 35 | public string Documentation 36 | { 37 | get { return this.documentation; } 38 | } 39 | 40 | public ReadOnlyCollection Parameters 41 | { 42 | get { return new ReadOnlyCollection(new IParameter[] { }); } 43 | } 44 | 45 | public string PrettyPrintedContent 46 | { 47 | get { return this.prettyPrintedContent; } 48 | } 49 | 50 | internal Signature(ITrackingSpan trackingSpan, string content, string prettyPrintedContent, string documentation) 51 | { 52 | this.trackingSpan = trackingSpan; 53 | this.content = content; 54 | this.prettyPrintedContent = prettyPrintedContent; 55 | this.documentation = documentation; 56 | } 57 | } 58 | 59 | readonly ITextBuffer subjectBuffer; 60 | readonly IEncouragements encouragements; 61 | 62 | public EncourageSignatureHelpSource(ITextBuffer subjectBuffer, IEncouragements encouragements) 63 | { 64 | this.subjectBuffer = subjectBuffer; 65 | this.encouragements = encouragements; 66 | } 67 | 68 | bool isDisposed; 69 | 70 | public void Dispose() 71 | { 72 | if (!isDisposed) 73 | { 74 | GC.SuppressFinalize(this); 75 | isDisposed = true; 76 | } 77 | } 78 | 79 | public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList signatures) 80 | { 81 | // Map the trigger point down to our buffer. 82 | var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot); 83 | if (!subjectTriggerPoint.HasValue) 84 | { 85 | return; 86 | } 87 | 88 | var currentSnapshot = subjectTriggerPoint.Value.Snapshot; 89 | var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0); 90 | var applicableToSpan = currentSnapshot.CreateTrackingSpan( 91 | querySpan.Start.Position, 92 | 1, 93 | SpanTrackingMode.EdgeInclusive); 94 | 95 | string encouragement = encouragements.GetRandomEncouragement(); 96 | var signature = new Signature(applicableToSpan, encouragement, "", ""); 97 | signatures.Add(signature); 98 | } 99 | 100 | public ISignature GetBestMatch(ISignatureHelpSession session) 101 | { 102 | return session.Signatures.Count > 0 ? session.Signatures[0] : null; 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /EncouragePackage/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 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 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | text/microsoft-resx 119 | 120 | 121 | 2.0 122 | 123 | 124 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 125 | 126 | 127 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 128 | 129 | -------------------------------------------------------------------------------- /EncouragePackage/VSPackage.resx: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 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 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | text/microsoft-resx 120 | 121 | 122 | 2.0 123 | 124 | 125 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 126 | 127 | 128 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 129 | 130 | 131 | 132 | Encourage 133 | 134 | 135 | Adds a bit of whimsy to your work day. 136 | 137 | 138 | Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 139 | 140 | -------------------------------------------------------------------------------- /EncouragePackage/EncouragePackage.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12.0 5 | 12.0 6 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 7 | 8 | 9 | 10 | Debug 11 | AnyCPU 12 | 2.0 13 | {4A77FC23-A472-47C8-93B5-F59691F53201} 14 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | Library 16 | Properties 17 | Haack.Encourage 18 | Encourage 19 | True 20 | Key.snk 21 | v4.5 22 | Program 23 | $(DevEnvDir)\devenv.exe 24 | /rootsuffix Exp 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\Debug\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | true 35 | 36 | 37 | pdbonly 38 | true 39 | bin\Release\ 40 | TRACE 41 | prompt 42 | 4 43 | true 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | true 60 | 61 | 62 | true 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2} 85 | 8 86 | 0 87 | 0 88 | primary 89 | False 90 | False 91 | 92 | 93 | {26AD1324-4B7C-44BC-84F8-B86AED45729F} 94 | 10 95 | 0 96 | 0 97 | primary 98 | False 99 | False 100 | 101 | 102 | {1A31287A-4D7D-413E-8E32-3B374931BD89} 103 | 8 104 | 0 105 | 0 106 | primary 107 | False 108 | False 109 | 110 | 111 | {2CE2370E-D744-4936-A090-3FFFE667B0E1} 112 | 9 113 | 0 114 | 0 115 | primary 116 | False 117 | False 118 | 119 | 120 | {1CBA492E-7263-47BB-87FE-639000619B15} 121 | 8 122 | 0 123 | 0 124 | primary 125 | False 126 | False 127 | 128 | 129 | {00020430-0000-0000-C000-000000000046} 130 | 2 131 | 0 132 | 0 133 | primary 134 | False 135 | False 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | True 149 | True 150 | Resources.resx 151 | 152 | 153 | 154 | 155 | 156 | 157 | ResXFileCodeGenerator 158 | Resources.Designer.cs 159 | Designer 160 | 161 | 162 | true 163 | VSPackage 164 | 165 | 166 | 167 | 168 | Designer 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | LICENSE.txt 177 | Always 178 | true 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | true 187 | 188 | 189 | 190 | 197 | -------------------------------------------------------------------------------- /Encourage.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True 3 | DO_NOT_SHOW 4 | <?xml version="1.0" encoding="utf-16"?><Profile name="CodeReformat"><JsReformatCode>True</JsReformatCode><CSReformatCode>True</CSReformatCode><CSUseVar><BehavourStyle>DISABLED</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>IMPLICIT_EXCEPT_SIMPLE_TYPES</ForeachVariableStyle></CSUseVar><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseAutoProperty>True</CSUseAutoProperty><HtmlReformatCode>True</HtmlReformatCode><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CssReformatCode>True</CssReformatCode><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings></Profile> 5 | CodeReformat 6 | False 7 | False 8 | False 9 | False 10 | False 11 | False 12 | False 13 | False 14 | False 15 | False 16 | False 17 | NEXT_LINE 18 | NEXT_LINE 19 | 1 20 | False 21 | False 22 | False 23 | NEXT_LINE 24 | 1 25 | 1 26 | True 27 | False 28 | False 29 | False 30 | True 31 | True 32 | False 33 | False 34 | <?xml version="1.0" encoding="utf-8"?> 35 | 36 | <!-- 37 | II. Available match operands 38 | 39 | Each operand may have Weight="..." attribute. This weight will be added to the match weight if the operand is evaluated to 'true'. 40 | The default weight is 1 41 | 42 | II.1 Boolean functions: 43 | II.1.1 <And>....</And> 44 | II.1.2 <Or>....</Or> 45 | II.1.3 <Not>....</Not> 46 | 47 | II.2 Operands 48 | II.2.1 <Kind Is="..."/>. Kinds are: class, struct, interface, enum, delegate, type, constructor, destructor, property, indexer, method, operator, field, constant, event, member 49 | II.2.2 <Name Is="..." [IgnoreCase="true/false"] />. The 'Is' attribute contains regular expression 50 | II.2.3 <HasAttribute CLRName="..." [Inherit="true/false"] />. The 'CLRName' attribute contains regular expression 51 | II.2.4 <Access Is="..."/>. The 'Is' values are: public, protected, internal, protected internal, private 52 | II.2.5 <Static/> 53 | II.2.6 <Abstract/> 54 | II.2.7 <Virtual/> 55 | II.2.8 <Override/> 56 | II.2.9 <Sealed/> 57 | II.2.10 <Readonly/> 58 | II.2.11 <ImplementsInterface CLRName="..."/>. The 'CLRName' attribute contains regular expression 59 | II.2.12 <HandlesEvent /> 60 | --> 61 | 62 | <Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns"> 63 | 64 | <!--Do not reorder COM interfaces and structs marked by StructLayout attribute--> 65 | <Pattern> 66 | <Match> 67 | <Or Weight="100"> 68 | <And> 69 | <Kind Is="interface"/> 70 | <Or> 71 | <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/> 72 | <HasAttribute CLRName="System.Runtime.InteropServices.ComImport"/> 73 | </Or> 74 | </And> 75 | <HasAttribute CLRName="System.Runtime.InteropServices.StructLayoutAttribute"/> 76 | </Or> 77 | </Match> 78 | </Pattern> 79 | 80 | <!--Special formatting of NUnit test fixture--> 81 | <Pattern RemoveAllRegions="true"> 82 | <Match> 83 | <And Weight="100"> 84 | <Kind Is="class"/> 85 | <HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/> 86 | </And> 87 | </Match> 88 | 89 | <!--Setup/Teardown--> 90 | <Entry> 91 | <Match> 92 | <And> 93 | <Kind Is="method"/> 94 | <Or> 95 | <HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/> 96 | <HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/> 97 | <HasAttribute CLRName="NUnit.Framework.TestFixtureSetUpAttribute" Inherit="true"/> 98 | <HasAttribute CLRName="NUnit.Framework.TestFixtureTearDownAttribute" Inherit="true"/> 99 | </Or> 100 | </And> 101 | </Match> 102 | <Group Region="Setup/Teardown"/> 103 | </Entry> 104 | 105 | <!--Test methods--> 106 | <Entry> 107 | <Match> 108 | <And Weight="100"> 109 | <Kind Is="method"/> 110 | <HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/> 111 | </And> 112 | </Match> 113 | <Sort> 114 | <Name/> 115 | </Sort> 116 | </Entry> 117 | 118 | <!--All other members--> 119 | <Entry> 120 | <Group Region="Supporting Code"/> 121 | </Entry> 122 | 123 | </Pattern> 124 | 125 | <!--Default pattern--> 126 | <Pattern> 127 | 128 | <!--public delegate--> 129 | <Entry> 130 | <Match> 131 | <And Weight="100"> 132 | <Access Is="public"/> 133 | <Kind Is="delegate"/> 134 | </And> 135 | </Match> 136 | <Sort> 137 | <Name/> 138 | </Sort> 139 | </Entry> 140 | 141 | <!--public enum--> 142 | <Entry> 143 | <Match> 144 | <And Weight="100"> 145 | <Access Is="public"/> 146 | <Kind Is="enum"/> 147 | </And> 148 | </Match> 149 | <Sort> 150 | <Name/> 151 | </Sort> 152 | <Group> 153 | <Name/> 154 | </Group> 155 | </Entry> 156 | 157 | <!--static fields and constants--> 158 | <Entry> 159 | <Match> 160 | <Or> 161 | <Kind Is="constant"/> 162 | <And> 163 | <Kind Is="field"/> 164 | <Static/> 165 | </And> 166 | </Or> 167 | </Match> 168 | <Sort> 169 | <Kind Order="constant field"/> 170 | </Sort> 171 | </Entry> 172 | 173 | <!--instance fields--> 174 | <Entry> 175 | <Match> 176 | <And> 177 | <Kind Is="field"/> 178 | <Not> 179 | <Static/> 180 | </Not> 181 | </And> 182 | </Match> 183 | <Sort> 184 | <Readonly/> 185 | <Name/> 186 | </Sort> 187 | </Entry> 188 | 189 | <!--Constructors. Place static one first--> 190 | <Entry> 191 | <Match> 192 | <Kind Is="constructor"/> 193 | </Match> 194 | <Sort> 195 | <Static/> 196 | </Sort> 197 | </Entry> 198 | 199 | <!--properties, indexers--> 200 | <Entry> 201 | <Match> 202 | <Or> 203 | <Kind Is="property"/> 204 | <Kind Is="indexer"/> 205 | </Or> 206 | </Match> 207 | <Sort> 208 | <Name/> 209 | </Sort> 210 | </Entry> 211 | 212 | <!--interface implementations--> 213 | <Entry> 214 | <Match> 215 | <And Weight="100"> 216 | <Kind Is="member"/> 217 | <ImplementsInterface/> 218 | </And> 219 | </Match> 220 | <Sort> 221 | <ImplementsInterface Immediate="true"/> 222 | </Sort> 223 | </Entry> 224 | 225 | <!--public methods--> 226 | <Entry> 227 | <Match> 228 | <And> 229 | <Kind Is="method"/> 230 | <Access Is="public"/> 231 | </And> 232 | </Match> 233 | <Sort> 234 | <Name/> 235 | </Sort> 236 | </Entry> 237 | 238 | <!--all other members--> 239 | <Entry> 240 | <Sort> 241 | <Name/> 242 | </Sort> 243 | </Entry> 244 | 245 | <!--nested types--> 246 | <Entry> 247 | <Match> 248 | <Kind Is="type"/> 249 | </Match> 250 | <Sort> 251 | <Name/> 252 | </Sort> 253 | <Group> 254 | <Name/> 255 | </Group> 256 | </Entry> 257 | </Pattern> 258 | 259 | </Patterns> 260 | 261 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> 262 | True 263 | <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> 264 | 265 | --------------------------------------------------------------------------------