├── .editorconfig ├── .gitattributes ├── .gitignore ├── CodeTourVS.sln ├── LICENSE ├── README.md ├── appveyor.yml ├── art └── Code Tour InfoBar.gif ├── lib └── Microsoft.VisualStudio.GraphModel.dll └── src ├── CodeTour.cs ├── CodeTourInfoBar.cs ├── CodeTourManager.cs ├── CodeTourVS.csproj ├── CodeTourVSPackage.cs ├── Commands └── GoToStepCommand.cs ├── Constants.cs ├── ExtensionMethods.cs ├── GlyphMargin ├── CodeTourGlyphFactory.cs ├── CodeTourGlyphFactoryProvider.cs ├── CodeTourGlyphMouseProcessor.cs ├── CodeTourGlyphMouseProcessorProvider.cs ├── CodeTourMarginProvider.cs ├── CodeTourTag.cs ├── CodeTourTagger.cs ├── CodeTourTaggerProvider.cs └── CodeTourrMargin.cs ├── Graph ├── CodeTourGraphNodeNavigator.cs ├── CodeTourGraphProvider.cs └── CodeTourSchema.cs ├── Peek ├── CodeTourPeekRelationship.cs ├── CodeTourPeekResult.cs ├── CodeTourPeekResultPresentation.cs ├── CodeTourPeekResultPresenter.cs ├── CodeTourPeekableItem.cs ├── CodeTourPeekableItemSource.cs ├── CodeTourPeekableItemSourceProvider.cs ├── CodeTourResultSource.cs ├── StepView.xaml └── StepView.xaml.cs ├── Properties └── AssemblyInfo.cs ├── Registry.pkgdef ├── Resources └── Icon.png ├── VSCommandTable.cs ├── VSCommandTable.vsct ├── 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 | ############################################################################### 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 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /CodeTourVS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30807.14 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeTourVS", "src\CodeTourVS.csproj", "{A65BBA87-689C-4536-93AE-8FE78D371E8B}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AE6E0A9E-E173-4D13-BDCD-AB246A55B99F}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | appveyor.yml = appveyor.yml 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 | {A65BBA87-689C-4536-93AE-8FE78D371E8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {A65BBA87-689C-4536-93AE-8FE78D371E8B}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {A65BBA87-689C-4536-93AE-8FE78D371E8B}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {A65BBA87-689C-4536-93AE-8FE78D371E8B}.Release|Any CPU.Build.0 = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | GlobalSection(ExtensibilityGlobals) = postSolution 30 | SolutionGuid = {6FE26DF4-CF6D-4F29-A9A4-6FBE24DA1069} 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Mads Kristensen 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Code Tours VS 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/j8mx6l6c97yemm2t?svg=true)](https://ci.appveyor.com/project/madskristensen/codetourvs) 4 | 5 | Code Tours shows guided tours through any source code base. They are easy to create and easy to use. 6 | 7 | Download this extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.CodeTours) 8 | or get the [CI build](https://www.vsixgallery.com/extension/9b0909ef-5ea4-4899-bacf-16c894b87ca0). 9 | 10 | ----------------------------------------- 11 | 12 | An implementation of the Code Tours extension for VS Code, but for Visual Studio 2019. 13 | 14 | ![Code Tours InfoBar](art/Code%20Tour%20InfoBar.gif) 15 | 16 | ## License 17 | [Apache 2.0](LICENSE) 18 | -------------------------------------------------------------------------------- /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 16 | -------------------------------------------------------------------------------- /art/Code Tour InfoBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/CodeTourVS/b3a918cd16bae2ef2060b8fb43d622d35b970a3f/art/Code Tour InfoBar.gif -------------------------------------------------------------------------------- /lib/Microsoft.VisualStudio.GraphModel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/CodeTourVS/b3a918cd16bae2ef2060b8fb43d622d35b970a3f/lib/Microsoft.VisualStudio.GraphModel.dll -------------------------------------------------------------------------------- /src/CodeTour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using Newtonsoft.Json; 6 | 7 | namespace CodeTourVS 8 | { 9 | public class CodeTour 10 | { 11 | [JsonIgnore()] 12 | public string File { get; set; } 13 | 14 | [JsonProperty("$schema")] 15 | public string Schema { get; set; } = "https://cdn.jsdelivr.net/gh/vsls-contrib/code-tour/schema.json"; 16 | 17 | [JsonProperty("title")] 18 | public string Title { get; set; } 19 | 20 | [JsonProperty("steps")] 21 | public IEnumerable Steps { get; set; } 22 | 23 | [JsonProperty("isPrimary")] 24 | public bool IsPrimary { get; set; } = true; 25 | 26 | public IEnumerable GetStepsFromFile(string fileName) 27 | { 28 | return Steps.Where(s => s.AbsoluteFile.Equals(fileName, StringComparison.OrdinalIgnoreCase)); 29 | } 30 | } 31 | 32 | public class Step 33 | { 34 | [JsonProperty("title")] 35 | public string Title { get; set; } 36 | 37 | [JsonProperty("file")] 38 | public string File { get; set; } 39 | 40 | [JsonProperty("line")] 41 | public int Line { get; set; } 42 | 43 | [JsonProperty("description")] 44 | public string Description { get; set; } 45 | 46 | [JsonProperty("selection")] 47 | public Selection Selection { get; set; } 48 | 49 | [JsonProperty("directory")] 50 | public string Directory { get; set; } 51 | 52 | [JsonIgnore] 53 | public CodeTour Tour { get; set; } 54 | 55 | [JsonIgnore] 56 | public string AbsoluteFile 57 | { 58 | get 59 | { 60 | // TODO: Support directory as well 61 | if (!string.IsNullOrEmpty(File)) 62 | { 63 | var folder = Path.GetDirectoryName(Tour.File); 64 | var absolute = Path.Combine(folder, "..\\", File).Replace("/", "\\"); 65 | var file = new FileInfo(absolute); 66 | 67 | return file.FullName; 68 | } 69 | 70 | return Path.Combine(Path.GetTempPath(), Title ?? Tour.Title ?? "Code Tour").Replace("/", "\\"); 71 | } 72 | } 73 | } 74 | 75 | public class Selection 76 | { 77 | [JsonProperty("start")] 78 | public Start Start { get; set; } 79 | 80 | [JsonProperty("end")] 81 | public End End { get; set; } 82 | } 83 | 84 | public class Start 85 | { 86 | [JsonProperty("line")] 87 | public int Line { get; set; } 88 | 89 | [JsonProperty("character")] 90 | public int Character { get; set; } 91 | } 92 | 93 | public class End 94 | { 95 | [JsonProperty("line")] 96 | public int Line { get; set; } 97 | 98 | [JsonProperty("character")] 99 | public int Character { get; set; } 100 | } 101 | 102 | } -------------------------------------------------------------------------------- /src/CodeTourInfoBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using Microsoft; 8 | using Microsoft.VisualStudio; 9 | using Microsoft.VisualStudio.Imaging; 10 | using Microsoft.VisualStudio.Shell; 11 | using Microsoft.VisualStudio.Shell.Interop; 12 | using Task = System.Threading.Tasks.Task; 13 | 14 | namespace CodeTourVS 15 | { 16 | public class CodeTourInfoBar : IVsInfoBarUIEvents 17 | { 18 | private readonly Solution2 _solution; 19 | private bool _isVisible = false; 20 | private IVsInfoBarUIElement _uiElement; 21 | 22 | private readonly static InfoBarModel _infoBarModel = 23 | new InfoBarModel( 24 | new[] { 25 | new InfoBarTextSpan("This solution has guided tours you can take to get familiar with the code base. "), 26 | new InfoBarHyperlink("Start CodeTour") 27 | }, 28 | KnownMonikers.PlayStepGroup, 29 | true); 30 | 31 | public CodeTourInfoBar(Solution2 solution) 32 | { 33 | _solution = solution; 34 | } 35 | 36 | public async Task HandleOpenSolutionAsync() 37 | { 38 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 39 | 40 | if (ToursExist() && !SolutionFolderExist()) 41 | { 42 | await ShowInfoBarAsync(); 43 | } 44 | } 45 | 46 | public void AddCodeToursToSolution() 47 | { 48 | ThreadHelper.ThrowIfNotOnUIThread(); 49 | 50 | Project solFolder = _solution.AddSolutionFolder(Constants.VirtualFolderName); 51 | var toursDir = _solution.GetToursFolder(); 52 | 53 | foreach (var file in Directory.EnumerateFiles(toursDir, $"*{Constants.TourFileExtension}")) 54 | { 55 | solFolder.ProjectItems.AddFromFile(file); 56 | } 57 | } 58 | 59 | public void CloseInfoBar() 60 | { 61 | ThreadHelper.ThrowIfNotOnUIThread(); 62 | if (_isVisible && _uiElement != null) 63 | { 64 | _uiElement.Close(); 65 | } 66 | } 67 | 68 | private bool ToursExist() 69 | { 70 | ThreadHelper.ThrowIfNotOnUIThread(); 71 | var toursDir = _solution.GetToursFolder(); 72 | 73 | return Directory.Exists(toursDir); 74 | } 75 | 76 | private bool SolutionFolderExist() 77 | { 78 | ThreadHelper.ThrowIfNotOnUIThread(); 79 | 80 | Project solutionFolder = _solution.Projects 81 | .Cast() 82 | #pragma warning disable VSTHRD010 // Invoke single-threaded types on Main thread 83 | .FirstOrDefault(p => p.Kind == ProjectKinds.vsProjectKindSolutionFolder && p.Name == Constants.VirtualFolderName); 84 | #pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread 85 | 86 | return solutionFolder != null; 87 | } 88 | 89 | public async Task ShowInfoBarAsync() 90 | { 91 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 92 | 93 | if (_isVisible || !await TryCreateInfoBarUIAsync(_infoBarModel)) 94 | { 95 | return; 96 | } 97 | 98 | _uiElement.Advise(this, out _); 99 | ToolWindowPane solutionExplorer = GetSolutionExplorerPane(); 100 | 101 | if (solutionExplorer != null) 102 | { 103 | solutionExplorer.AddInfoBar(_uiElement); 104 | _isVisible = true; 105 | } 106 | } 107 | 108 | private async Task TryCreateInfoBarUIAsync(IVsInfoBar infoBar) 109 | { 110 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 111 | IVsInfoBarUIFactory infoBarUIFactory = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(); 112 | 113 | _uiElement = infoBarUIFactory.CreateInfoBar(infoBar); 114 | return _uiElement != null; 115 | } 116 | 117 | private static ToolWindowPane GetSolutionExplorerPane() 118 | { 119 | ThreadHelper.ThrowIfNotOnUIThread(); 120 | var uiShell = ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; 121 | Assumes.Present(uiShell); 122 | 123 | var slnExplorerGuid = new Guid(ToolWindowGuids80.SolutionExplorer); 124 | 125 | if (ErrorHandler.Succeeded(uiShell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref slnExplorerGuid, out IVsWindowFrame frame))) 126 | { 127 | if (ErrorHandler.Succeeded(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out var pane))) 128 | { 129 | return pane as ToolWindowPane; 130 | } 131 | } 132 | 133 | return null; 134 | } 135 | 136 | public void OnClosed(IVsInfoBarUIElement infoBarUIElement) 137 | { 138 | _isVisible = false; 139 | } 140 | 141 | public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) 142 | { 143 | ThreadHelper.ThrowIfNotOnUIThread(); 144 | 145 | AddCodeToursToSolution(); 146 | infoBarUIElement.Close(); 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/CodeTourManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using Newtonsoft.Json; 9 | 10 | namespace CodeTourVS 11 | { 12 | public class CodeTourManager 13 | { 14 | public List Tours { get; private set; } = new List(); 15 | 16 | public static Step CurrentStep { get; set; } 17 | 18 | public static async Task FromFolderAsync(string toursFolder, CancellationToken cancellationToken = default) 19 | { 20 | var manager = new CodeTourManager(); 21 | 22 | if (Directory.Exists(toursFolder)) 23 | { 24 | foreach (var file in Directory.EnumerateFiles(toursFolder, $"*{Constants.TourFileExtension}")) 25 | { 26 | if (cancellationToken.IsCancellationRequested) 27 | { 28 | break; 29 | } 30 | 31 | CodeTour tour = await manager.LoadTourAsync(file); 32 | manager.Tours.Add(tour); 33 | } 34 | } 35 | 36 | return manager; 37 | } 38 | 39 | public static Task FromSourceFileAsync(string sourceFile, CancellationToken cancellationToken = default) 40 | { 41 | var parent = new DirectoryInfo(Path.GetDirectoryName(sourceFile)); 42 | 43 | while (parent != null) 44 | { 45 | foreach (DirectoryInfo dir in parent.GetDirectories($"*{Constants.ToursDirName}", SearchOption.TopDirectoryOnly)) 46 | { 47 | if (dir.Name == Constants.ToursDirName) 48 | { 49 | return FromFolderAsync(dir.FullName, cancellationToken); 50 | } 51 | } 52 | 53 | parent = parent.Parent; 54 | } 55 | 56 | return Task.FromResult(new CodeTourManager()); 57 | } 58 | 59 | public CodeTour GetTour(string tourFile) 60 | { 61 | return Tours.FirstOrDefault(t => t.File.Equals(tourFile, StringComparison.OrdinalIgnoreCase)); 62 | } 63 | 64 | public IEnumerable GetStepsContainingFile(string sourceFile) 65 | { 66 | var list = new List(); 67 | 68 | foreach (CodeTour tour in Tours) 69 | { 70 | list.AddRange(tour.GetStepsFromFile(sourceFile)); 71 | } 72 | 73 | return list; 74 | } 75 | 76 | private async Task LoadTourAsync(string fileName) 77 | { 78 | var list = new List(); 79 | 80 | try 81 | { 82 | using (var reader = new StreamReader(fileName)) 83 | { 84 | var json = await reader.ReadToEndAsync(); 85 | CodeTour tour = JsonConvert.DeserializeObject(json); 86 | tour.File = fileName; 87 | 88 | foreach (Step step in tour.Steps) 89 | { 90 | step.Tour = tour; 91 | step.Title = step.Title ?? step.File ?? step.Directory; 92 | list.Add(step); 93 | } 94 | 95 | return tour; 96 | } 97 | } 98 | catch (Exception ex) 99 | { 100 | Trace.Fail(ex.ToString()); 101 | return null; 102 | } 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/CodeTourVS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 16.0 5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 2.0 12 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 13 | {A65BBA87-689C-4536-93AE-8FE78D371E8B} 14 | Library 15 | Properties 16 | CodeTourVS 17 | CodeTourVS 18 | v4.7.2 19 | true 20 | true 21 | true 22 | false 23 | false 24 | true 25 | true 26 | Program 27 | $(DevEnvDir)devenv.exe 28 | /rootsuffix Exp 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | StepView.xaml 59 | 60 | 61 | True 62 | True 63 | VSCommandTable.vsct 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | True 81 | True 82 | source.extension.vsixmanifest 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Resources\LICENSE 91 | true 92 | 93 | 94 | VsctGenerator 95 | Menus.ctmenu 96 | VSCommandTable.cs 97 | 98 | 99 | true 100 | 101 | 102 | Designer 103 | VsixManifestGenerator 104 | source.extension.cs 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 0.4.0 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | true 132 | Always 133 | 134 | 135 | 136 | 137 | Designer 138 | MSBuild:Compile 139 | 140 | 141 | 142 | 143 | 150 | -------------------------------------------------------------------------------- /src/CodeTourVSPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using EnvDTE; 6 | using EnvDTE80; 7 | using Microsoft; 8 | using Microsoft.VisualStudio; 9 | using Microsoft.VisualStudio.Shell; 10 | using Microsoft.VisualStudio.Shell.Interop; 11 | using SolutionEvents = Microsoft.VisualStudio.Shell.Events.SolutionEvents; 12 | using Task = System.Threading.Tasks.Task; 13 | 14 | namespace CodeTourVS 15 | { 16 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 17 | [Guid("a139934a-4daf-44ff-af02-aa018c2ae51f")] 18 | [ProvideBindingPath()] 19 | [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionOpening_string, PackageAutoLoadFlags.BackgroundLoad)] 20 | [ProvideMenuResource("Menus.ctmenu", 1)] 21 | public sealed class CodeTourVSPackage : AsyncPackage 22 | { 23 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 24 | { 25 | // Since this package might not be initialized until after a solution has finished loading, 26 | // we need to check if a solution has already been loaded and then handle it. 27 | var isSolutionLoaded = await IsSolutionLoadedAsync(); 28 | 29 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 30 | var dte = await GetServiceAsync(typeof(DTE)) as DTE; 31 | Assumes.Present(dte); 32 | 33 | var loader = new CodeTourInfoBar(dte.Solution as Solution2); 34 | 35 | if (isSolutionLoaded) 36 | { 37 | loader.HandleOpenSolutionAsync() 38 | .FileAndForget(nameof(CodeTourVSPackage)); 39 | } 40 | 41 | // Listen for subsequent solution events 42 | SolutionEvents.OnAfterBackgroundSolutionLoadComplete += delegate 43 | { 44 | loader.HandleOpenSolutionAsync() 45 | .FileAndForget(nameof(CodeTourVSPackage)); 46 | }; 47 | 48 | SolutionEvents.OnAfterCloseSolution += delegate 49 | { 50 | loader.CloseInfoBar(); 51 | }; 52 | await GoToStepCommand.InitializeAsync(this); 53 | } 54 | 55 | private async Task IsSolutionLoadedAsync() 56 | { 57 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 58 | var solService = await GetServiceAsync(typeof(SVsSolution)) as IVsSolution; 59 | Assumes.Present(solService); 60 | 61 | ErrorHandler.ThrowOnFailure(solService.GetProperty((int)__VSPROPID.VSPROPID_IsSolutionOpen, out var value)); 62 | 63 | return value is bool isSolOpen && isSolOpen; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Commands/GoToStepCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Composition; 3 | using System.ComponentModel.Design; 4 | using System.IO; 5 | using System.Linq; 6 | using EnvDTE; 7 | using Microsoft; 8 | using Microsoft.VisualStudio; 9 | using Microsoft.VisualStudio.ComponentModelHost; 10 | using Microsoft.VisualStudio.Editor; 11 | using Microsoft.VisualStudio.Language.Intellisense; 12 | using Microsoft.VisualStudio.Shell; 13 | using Microsoft.VisualStudio.Shell.Interop; 14 | using Microsoft.VisualStudio.Text.Editor; 15 | using Microsoft.VisualStudio.TextManager.Interop; 16 | using Task = System.Threading.Tasks.Task; 17 | 18 | namespace CodeTourVS 19 | { 20 | internal sealed class GoToStepCommand 21 | { 22 | private readonly AsyncPackage _package; 23 | private readonly DTE _dte; 24 | 25 | public GoToStepCommand(AsyncPackage package, DTE dte) 26 | { 27 | _package = package; 28 | _dte = dte; 29 | } 30 | 31 | [Import] 32 | private IPeekBroker PeekBroker { get; set; } 33 | 34 | public static async Task InitializeAsync(AsyncPackage package) 35 | { 36 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); 37 | 38 | OleMenuCommandService commandService = await package.GetServiceAsync(); 39 | DTE dte = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(); 40 | IComponentModel compositionService = await package.GetServiceAsync(); 41 | 42 | var instance = new GoToStepCommand(package, dte); 43 | 44 | var cmdId = new CommandID(PackageGuids.CodeTourCmdSet, PackageIds.GoToStepCommand); 45 | var cmd = new OleMenuCommand(instance.Execute, cmdId); 46 | commandService.AddCommand(cmd); 47 | 48 | compositionService.DefaultCompositionService.SatisfyImportsOnce(instance); 49 | } 50 | 51 | private void Execute(object sender, EventArgs e) 52 | { 53 | ThreadHelper.ThrowIfNotOnUIThread(); 54 | 55 | using (new NewDocumentStateScope(__VSNEWDOCUMENTSTATE2.NDS_TryProvisional, VSConstants.NewDocumentStateReason.SolutionExplorer)) 56 | { 57 | VsShellUtilities.OpenDocument(_package, CodeTourManager.CurrentStep.AbsoluteFile); 58 | } 59 | 60 | if (CodeTourManager.CurrentStep.Line > 0) 61 | { 62 | _dte.ExecuteCommand("Edit.GoTo", CodeTourManager.CurrentStep.Line.ToString()); 63 | } 64 | 65 | PeekBroker.TriggerPeekSession(GetTextView(), CodeTourPeekRelationship.RelationshipName); 66 | } 67 | 68 | //private async Task NavigateAsync(string tourFile, int stepNumber) 69 | //{ 70 | // await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 71 | 72 | // var tourFolder = Path.GetDirectoryName(tourFile); 73 | // var manager = await CodeTourManager.FromFolderAsync(tourFolder); 74 | // var tour = manager.GetTour(tourFile); 75 | 76 | // if (tour != null && tour.Steps.Count() >= stepNumber) 77 | // { 78 | // var step = tour.Steps.ElementAt(stepNumber); 79 | 80 | // var dte = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(); 81 | // dte?.ExecuteCommand("Edit.GoTo", step.Line.ToString()); 82 | // } 83 | //} 84 | 85 | public IWpfTextView GetTextView() 86 | { 87 | ThreadHelper.ThrowIfNotOnUIThread(); 88 | 89 | var compService = ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)) as IComponentModel; 90 | Assumes.Present(compService); 91 | 92 | IVsEditorAdaptersFactoryService editorAdapter = compService.GetService(); 93 | 94 | var textManager = ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)) as IVsTextManager; 95 | Assumes.Present(textManager); 96 | 97 | ErrorHandler.ThrowOnFailure(textManager.GetActiveView(1, null, out IVsTextView activeView)); 98 | 99 | return editorAdapter.GetWpfTextView(activeView); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace CodeTourVS 2 | { 3 | public class Constants 4 | { 5 | public const string ToursDirName = ".tours"; 6 | public const string TourFileExtension = ".tour"; 7 | public const string VirtualFolderName = "Code Tours"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.InteropServices; 4 | using System.Threading.Tasks; 5 | using System.Windows.Media.Imaging; 6 | using EnvDTE80; 7 | using Microsoft.VisualStudio.Imaging.Interop; 8 | using Microsoft.VisualStudio.PlatformUI; 9 | using Microsoft.VisualStudio.Shell; 10 | using Microsoft.VisualStudio.Shell.Interop; 11 | 12 | namespace CodeTourVS 13 | { 14 | public static class ExtensionMethods 15 | { 16 | public static string GetToursFolder(this Solution2 solution) 17 | { 18 | ThreadHelper.ThrowIfNotOnUIThread(); 19 | var slnDir = Path.GetDirectoryName(solution.FullName); 20 | return Path.Combine(slnDir, Constants.ToursDirName); 21 | } 22 | 23 | public static async Task ToImageSourceAsync(this ImageMoniker moniker, int size) 24 | { 25 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 26 | 27 | IVsUIObject result = await ToUiObjectAsync(moniker, size); 28 | 29 | result.get_Data(out var data); 30 | 31 | if (data == null) 32 | return null; 33 | 34 | return data as BitmapSource; 35 | } 36 | 37 | public static async Task ToUiObjectAsync(this ImageMoniker moniker, int size) 38 | { 39 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 40 | IVsImageService2 imageService = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(); 41 | var backColor = VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey); 42 | 43 | var imageAttributes = new ImageAttributes 44 | { 45 | Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags | unchecked((uint)_ImageAttributesFlags.IAF_Background), 46 | ImageType = (uint)_UIImageType.IT_Bitmap, 47 | Format = (uint)_UIDataFormat.DF_WPF, 48 | LogicalHeight = size, 49 | LogicalWidth = size, 50 | Background = (uint)backColor.ToArgb(), 51 | StructSize = Marshal.SizeOf(typeof(ImageAttributes)) 52 | }; 53 | 54 | return imageService.GetImage(moniker, imageAttributes); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourGlyphFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using Microsoft.VisualStudio.Imaging; 4 | using Microsoft.VisualStudio.Shell; 5 | using Microsoft.VisualStudio.Text.Editor; 6 | using Microsoft.VisualStudio.Text.Formatting; 7 | 8 | namespace CodeTourVS 9 | { 10 | internal class CodeTourGlyphFactory : IGlyphFactory 11 | { 12 | public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) 13 | { 14 | var image = new Image(); 15 | 16 | ThreadHelper.JoinableTaskFactory.Run(async () => 17 | { 18 | image.Source = await KnownMonikers.Favorite.ToImageSourceAsync(10); 19 | }); 20 | 21 | return image; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourGlyphFactoryProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Text.Editor; 3 | using Microsoft.VisualStudio.Utilities; 4 | using Microsoft.VisualStudio.Text.Tagging; 5 | 6 | namespace CodeTourVS 7 | { 8 | [Export(typeof(IGlyphFactoryProvider))] 9 | [Name(nameof(CodeTourGlyphFactoryProvider))] 10 | [Order(Before = "VsTextMarker")] 11 | [ContentType("code")] 12 | [TagType(typeof(CodeTourTag))] 13 | internal sealed class CodeTourGlyphFactoryProvider : IGlyphFactoryProvider 14 | { 15 | // TODO: Implement IGlyphMouseProcessorProvider 16 | 17 | public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin) 18 | { 19 | return new CodeTourGlyphFactory(); 20 | } 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourGlyphMouseProcessor.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Windows; 3 | using System.Windows.Input; 4 | using Microsoft.VisualStudio.Language.Intellisense; 5 | using Microsoft.VisualStudio.Shell; 6 | using Microsoft.VisualStudio.Text; 7 | using Microsoft.VisualStudio.Text.Adornments; 8 | using Microsoft.VisualStudio.Text.Editor; 9 | using Microsoft.VisualStudio.Text.Tagging; 10 | 11 | namespace CodeTourVS 12 | { 13 | public class CodeTourGlyphMouseProcessor : MouseProcessorBase 14 | { 15 | private readonly IWpfTextViewHost _host; 16 | private readonly IToolTipService _toolTipService; 17 | private readonly IPeekBroker _peekBroker; 18 | private ITagAggregator _tagAggregator; 19 | private CodeTourTag _currentTag; 20 | private IToolTipPresenter _toolTipPresenter; 21 | 22 | public CodeTourGlyphMouseProcessor(IWpfTextViewHost host, IViewTagAggregatorFactoryService viewTagAggregatorService, IToolTipService toolTipService, IPeekBroker peekBroker) 23 | { 24 | _tagAggregator = viewTagAggregatorService.CreateTagAggregator(host.TextView); 25 | _host = host; 26 | _toolTipService = toolTipService; 27 | _peekBroker = peekBroker; 28 | } 29 | 30 | public override void PostprocessMouseLeftButtonUp(MouseButtonEventArgs e) 31 | { 32 | ThreadHelper.ThrowIfNotOnUIThread(); 33 | ITextView view = _host.TextView; 34 | 35 | Point mousePosition = Mouse.GetPosition(_host.TextView.VisualElement); 36 | mousePosition.Offset(_host.TextView.ViewportLeft, _host.TextView.ViewportTop); 37 | 38 | var line = view.TextViewLines.GetTextViewLineContainingYCoordinate(mousePosition.Y); 39 | //view.Caret.MoveTo(line); 40 | 41 | IMappingTagSpan eSpan = _tagAggregator.GetTags(line.ExtentAsMappingSpan).FirstOrDefault(); 42 | CodeTourManager.CurrentStep = eSpan.Tag.Step; 43 | 44 | var dte = ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; 45 | dte?.ExecuteCommand("CodeTours.GoToStep"); 46 | } 47 | 48 | public override void PostprocessMouseMove(MouseEventArgs e) 49 | { 50 | ITextView view = _host.TextView; 51 | 52 | Point mousePosition = Mouse.GetPosition(_host.TextView.VisualElement); 53 | mousePosition.Offset(_host.TextView.ViewportLeft, _host.TextView.ViewportTop); 54 | 55 | var line = view.TextViewLines.GetTextViewLineContainingYCoordinate(mousePosition.Y); 56 | if (line != null) 57 | { 58 | IMappingTagSpan eSpan = _tagAggregator.GetTags(line.ExtentAsMappingSpan).FirstOrDefault(); 59 | 60 | if (eSpan != null) 61 | SetTooltip(eSpan.Tag, view.TextSnapshot.CreateTrackingSpan(line.Start, line.Length, SpanTrackingMode.EdgeExclusive)); 62 | else 63 | SetTooltip(null, null); 64 | } 65 | } 66 | 67 | private void SetTooltip(CodeTourTag newTag, ITrackingSpan trackingSpan) 68 | { 69 | if (newTag != null) 70 | { 71 | if ((_currentTag == null) || (newTag.Step != _currentTag.Step)) 72 | { 73 | 74 | _toolTipPresenter = _toolTipService.CreatePresenter(_host.TextView); 75 | _toolTipPresenter.StartOrUpdate(trackingSpan, new[] { newTag.Step.Title }); 76 | _currentTag = newTag; 77 | } 78 | } 79 | else if (_currentTag != null) 80 | { 81 | _toolTipPresenter.Dismiss(); 82 | _currentTag = null; 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourGlyphMouseProcessorProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Text.Adornments; 4 | using Microsoft.VisualStudio.Text.Editor; 5 | using Microsoft.VisualStudio.Text.Tagging; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | namespace CodeTourVS 9 | { 10 | [Export(typeof(IGlyphMouseProcessorProvider))] 11 | [Name(nameof(CodeTourGlyphMouseProcessorProvider))] 12 | [Order] 13 | [ContentType("text")] 14 | class CodeTourGlyphMouseProcessorProvider : IGlyphMouseProcessorProvider 15 | { 16 | [Import] 17 | private IViewTagAggregatorFactoryService ViewTagAggregatorService { get; set; } 18 | 19 | [Import] 20 | private IPeekBroker PeekBroker { get; set; } 21 | 22 | [Import] 23 | internal IToolTipService ToolTipProvider { get; set; } 24 | 25 | public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost host, IWpfTextViewMargin margin) 26 | { 27 | return new CodeTourGlyphMouseProcessor(host, ViewTagAggregatorService, ToolTipProvider, PeekBroker); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourMarginProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.Composition; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Text; 5 | using Microsoft.VisualStudio.Text.Editor; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | namespace CodeTourVS 9 | { 10 | public class CodeTourMarginProvider 11 | { 12 | //[Export(typeof(IWpfTextViewMarginProvider))] 13 | [Name("MarginRightFactory")] 14 | [Order(After = PredefinedMarginNames.LineNumber)] 15 | [MarginContainer(PredefinedMarginNames.Left)] 16 | [ContentType("text")] 17 | [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] 18 | public class BrowserMarginRightProvider : IWpfTextViewMarginProvider 19 | { 20 | [Import] 21 | public ITextDocumentFactoryService DocumentService { get; set; } 22 | 23 | [Import(typeof(SVsServiceProvider))] 24 | public IServiceProvider ServiceProvider { get; set; } 25 | 26 | public IWpfTextViewMargin CreateMargin(IWpfTextViewHost host, IWpfTextViewMargin marginContainer) 27 | { 28 | if (!DocumentService.TryGetTextDocument(host.TextView.TextDataModel.DocumentBuffer, out ITextDocument doc)) 29 | { 30 | return null; 31 | } 32 | 33 | return host.TextView.Properties.GetOrCreateSingletonProperty(() => 34 | new CodeTourrMargin(host.TextView, doc, ServiceProvider) 35 | ); 36 | } 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourTag.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Text.Editor; 2 | 3 | namespace CodeTourVS 4 | { 5 | internal class CodeTourTag : IGlyphTag 6 | { 7 | public CodeTourTag(Step step) 8 | { 9 | Step = step; 10 | } 11 | 12 | public Step Step { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourTagger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.Text; 5 | using Microsoft.VisualStudio.Text.Editor; 6 | using Microsoft.VisualStudio.Text.Tagging; 7 | 8 | namespace CodeTourVS 9 | { 10 | internal class CodeTourTagger : ITagger 11 | { 12 | private ITextView _textView; 13 | private readonly ITextDocument _document; 14 | private readonly IEnumerable _steps; 15 | 16 | public CodeTourTagger(ITextView textView, ITextDocument document, IEnumerable steps) 17 | { 18 | _textView = textView; 19 | _document = document; 20 | _steps = steps; 21 | } 22 | 23 | IEnumerable> ITagger.GetTags(NormalizedSnapshotSpanCollection spans) 24 | { 25 | foreach (SnapshotSpan curSpan in spans) 26 | { 27 | var parentSpan = curSpan.TranslateTo(_textView.TextBuffer.CurrentSnapshot, SpanTrackingMode.EdgeExclusive); 28 | var line = parentSpan.Snapshot.GetLineFromPosition(parentSpan.Start.Position); 29 | 30 | var step = _steps.FirstOrDefault(s => s.Line - 1 == line.LineNumber); 31 | 32 | if (step != null) 33 | { 34 | var ctSpan = new SnapshotSpan(parentSpan.Snapshot, line.Extent); 35 | yield return new TagSpan(ctSpan, new CodeTourTag(step)); 36 | } 37 | } 38 | } 39 | 40 | public event EventHandler TagsChanged 41 | { 42 | add { } 43 | remove { } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourTaggerProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Text; 5 | using Microsoft.VisualStudio.Text.Editor; 6 | using Microsoft.VisualStudio.Text.Tagging; 7 | using Microsoft.VisualStudio.Utilities; 8 | 9 | namespace CodeTourVS 10 | { 11 | [Export(typeof(IViewTaggerProvider))] 12 | [ContentType("code")] 13 | [TagType(typeof(CodeTourTag))] 14 | class CodeTourTaggerProvider : IViewTaggerProvider 15 | { 16 | [Import] 17 | public ITextDocumentFactoryService DocumentService { get; set; } 18 | 19 | public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag 20 | { 21 | 22 | if (DocumentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out ITextDocument doc)) 23 | { 24 | CodeTourManager manager = null; 25 | 26 | ThreadHelper.JoinableTaskFactory.Run(async () => 27 | { 28 | manager = await CodeTourManager.FromSourceFileAsync(doc.FilePath); 29 | }); 30 | 31 | var steps = manager.GetStepsContainingFile(doc.FilePath); 32 | 33 | if (steps.Any()) 34 | { 35 | return new CodeTourTagger(textView, doc, steps) as ITagger; 36 | } 37 | 38 | } 39 | 40 | return null; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/GlyphMargin/CodeTourrMargin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using Microsoft.VisualStudio.Imaging; 5 | using Microsoft.VisualStudio.Shell; 6 | using Microsoft.VisualStudio.Text; 7 | using Microsoft.VisualStudio.Text.Editor; 8 | 9 | namespace CodeTourVS 10 | { 11 | internal class CodeTourrMargin : DockPanel, IWpfTextViewMargin 12 | { 13 | private IWpfTextView _textView; 14 | private ITextDocument _document; 15 | private readonly IServiceProvider _provider; 16 | 17 | public CodeTourrMargin(IWpfTextView textView, ITextDocument document, IServiceProvider provider) 18 | { 19 | _textView = textView; 20 | _document = document; 21 | _provider = provider; 22 | 23 | Initialized += CodeTourrMargin_Initialized; 24 | VerticalAlignment = VerticalAlignment.Top; 25 | } 26 | 27 | private void CodeTourrMargin_Initialized(object sender, EventArgs e) 28 | { 29 | var line = _textView.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(4); 30 | var height = _textView.GetTextViewLineContainingBufferPosition(line.Start).Top; 31 | 32 | ThreadHelper.JoinableTaskFactory.RunAsync(async() => { 33 | 34 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 35 | 36 | var Image = new Image 37 | { 38 | Margin = new Thickness(0, height, 0, 0), 39 | Width = 12, 40 | Height = 12, 41 | Source = await KnownMonikers.PlayStep.ToImageSourceAsync(12) 42 | }; 43 | 44 | Children.Add(Image); 45 | }); 46 | } 47 | 48 | public FrameworkElement VisualElement => this; 49 | 50 | public double MarginSize => 12; 51 | 52 | public bool Enabled => true; 53 | 54 | public ITextViewMargin GetTextViewMargin(string marginName) 55 | { 56 | return this; 57 | } 58 | 59 | public void Dispose() 60 | { 61 | // TODO: dispose things 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /src/Graph/CodeTourGraphNodeNavigator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.GraphModel; 5 | using Microsoft.VisualStudio.GraphModel.CodeSchema; 6 | using Microsoft.VisualStudio.GraphModel.Schemas; 7 | using Microsoft.VisualStudio.Shell; 8 | 9 | namespace CodeTourVS 10 | { 11 | public class CodeTourGraphNodeNavigator : IGraphNavigateToItem 12 | { 13 | public IServiceProvider serviceProvider; 14 | 15 | public int GetRank(GraphObject graphObject) => 0; 16 | 17 | public void NavigateTo(GraphObject obj) 18 | { 19 | ThreadHelper.ThrowIfNotOnUIThread(); 20 | 21 | var node = (GraphNode)obj; 22 | SourceLocation loc = node.GetValue(CodeNodeProperties.SourceLocation); 23 | 24 | ThreadHelper.JoinableTaskFactory.RunAsync(async () => 25 | { 26 | CodeTourManager manager = await CodeTourManager.FromSourceFileAsync(loc.FileName.OriginalString); 27 | 28 | IEnumerable stepsInFile = manager.GetStepsContainingFile(loc.FileName.OriginalString); 29 | CodeTourManager.CurrentStep = stepsInFile.FirstOrDefault(s => s.Line == loc.StartPosition.Line); 30 | 31 | if (CodeTourManager.CurrentStep != null) 32 | { 33 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 34 | EnvDTE.DTE dte = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(); 35 | dte?.ExecuteCommand("CodeTours.GoToStep"); 36 | } 37 | }).FileAndForget(nameof(CodeTourGraphNodeNavigator)); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Graph/CodeTourGraphProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.IO; 5 | using System.Linq; 6 | using Microsoft.Internal.VisualStudio.PlatformUI; 7 | using Microsoft.VisualStudio.GraphModel; 8 | using Microsoft.VisualStudio.GraphModel.CodeSchema; 9 | using Microsoft.VisualStudio.GraphModel.Schemas; 10 | using Microsoft.VisualStudio.Imaging; 11 | using Microsoft.VisualStudio.Shell; 12 | using Microsoft.VisualStudio.Shell.Interop; 13 | using Microsoft.VisualStudio.Threading; 14 | using Task = System.Threading.Tasks.Task; 15 | 16 | namespace CodeTourVS 17 | { 18 | 19 | [GraphProvider(Name = Vsix.Name)] 20 | public partial class CodeTourGraphProvider : IGraphProvider 21 | { 22 | private const string _iconStep = "step"; 23 | 24 | private static bool _imagesRegistered; 25 | 26 | [Import(typeof(SVsServiceProvider))] 27 | private IServiceProvider ServiceProvider { get; set; } 28 | 29 | public void BeginGetGraphData(IGraphContext context) 30 | { 31 | if (context.Direction == GraphContextDirection.Self && 32 | context.RequestedProperties.Contains(DgmlNodeProperties.ContainsChildren)) 33 | { 34 | MarkThatNodesHaveChildren(context); 35 | RegisterImagesAsync().FileAndForget(nameof(CodeTourGraphProvider.BeginGetGraphData)); 36 | context.OnCompleted(); 37 | } 38 | 39 | else if (context.Direction == GraphContextDirection.Self || 40 | (context.Direction == GraphContextDirection.Contains && context.InputNodes.ElementAt(0).HasCategory(CodeTourSchema.Tour))) 41 | { 42 | ThreadHelper.JoinableTaskFactory.RunAsync(async () => 43 | { 44 | try 45 | { 46 | await PopulateChildrenOfNodesAsync(context).ConfigureAwait(false); 47 | } 48 | catch 49 | { 50 | } 51 | finally 52 | { 53 | context.OnCompleted(); 54 | } 55 | }); 56 | } 57 | } 58 | 59 | private static void MarkThatNodesHaveChildren(IGraphContext context) 60 | { 61 | using (var scope = new GraphTransactionScope()) 62 | { 63 | foreach (GraphNode node in context.InputNodes.Where(IsCodeTourFile)) 64 | { 65 | node.SetValue(DgmlNodeProperties.ContainsChildren, true); 66 | node.AddCategory(CodeTourSchema.Tour); 67 | } 68 | 69 | scope.Complete(); 70 | } 71 | } 72 | 73 | private async Task PopulateChildrenOfNodesAsync(IGraphContext context) 74 | { 75 | using (var scope = new GraphTransactionScope()) 76 | { 77 | foreach (GraphNode tourNode in context.InputNodes.Where(IsCodeTourFile)) 78 | { 79 | Graph graph = tourNode.Owner; 80 | var fileName = tourNode.Id.GetNestedValueByName(CodeGraphNodeIdName.File).LocalPath; 81 | var tourFolder = Path.GetDirectoryName(fileName); 82 | CodeTourManager manager = await CodeTourManager.FromFolderAsync(tourFolder, context.CancelToken); 83 | CodeTour tour = manager.GetTour(fileName); 84 | var padding = tour.Steps.Count().ToString().Length; 85 | var stepNo = 1; 86 | 87 | foreach (Step step in tour.Steps) 88 | { 89 | try 90 | { 91 | var uniqueName = $"#{stepNo++.ToString().PadLeft(padding, '0')} - {step.Title}"; 92 | 93 | GraphNodeId valueId = tourNode.Id + GraphNodeId.GetPartial(CodeTourSchema.StepValueName, uniqueName); 94 | GraphNode stepNode = graph.Nodes.GetOrCreate(valueId, uniqueName, CodeTourSchema.Step); 95 | 96 | EnsureAbsolutePath(step); 97 | var loc = new SourceLocation(step.AbsoluteFile, new Position(step.Line, 0)); 98 | stepNode.SetValue(CodeNodeProperties.SourceLocation, loc); 99 | stepNode[DgmlNodeProperties.Icon] = _iconStep; 100 | 101 | GraphLink link = graph.Links.GetOrCreate(tourNode, stepNode, null, CodeTourSchema.TourToStepLink); 102 | link.SetValue("step", step); 103 | context.OutputNodes.Add(stepNode); 104 | } 105 | catch (Exception ex) 106 | { 107 | context.ReportError(ex); 108 | } 109 | finally 110 | { 111 | context.ReportProgress(stepNo - 1, tour.Steps.Count(), null); 112 | } 113 | } 114 | } 115 | scope.Complete(); 116 | } 117 | 118 | context.OnCompleted(); 119 | } 120 | 121 | private void EnsureAbsolutePath(Step step) 122 | { 123 | if (!File.Exists(step.AbsoluteFile) && step.AbsoluteFile.Contains(Path.GetTempPath())) 124 | { 125 | PackageUtilities.EnsureOutputPath(step.AbsoluteFile); 126 | } 127 | } 128 | 129 | private static bool IsCodeTourFile(GraphNode node) 130 | { 131 | var localPath = node.Id.GetNestedValueByName(CodeGraphNodeIdName.File)?.OriginalString; 132 | 133 | return node.HasCategory(CodeNodeCategories.File) && 134 | localPath.EndsWith(".tour"); 135 | } 136 | 137 | protected async Task RegisterImagesAsync() 138 | { 139 | if (_imagesRegistered) 140 | { 141 | return; 142 | } 143 | 144 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 145 | IVsImageService2 imageService = await AsyncServiceProvider.GlobalProvider.GetServiceAsync(); 146 | IVsUIObject icon = await KnownMonikers.Favorite.ToUiObjectAsync(16); 147 | 148 | imageService.Add(_iconStep, icon); 149 | _imagesRegistered = true; 150 | } 151 | 152 | public T GetExtension(GraphObject graphObject, T previous) where T : class 153 | => typeof(T) == typeof(IGraphNavigateToItem) ? new CodeTourGraphNodeNavigator() { serviceProvider = ServiceProvider } as T : null; 154 | 155 | public Graph Schema => null; // only for architecture explorer 156 | 157 | public IEnumerable GetCommands(IEnumerable nodes) 158 | { 159 | return new[] { 160 | new GraphCommand(GraphCommandDefinition.Contains, new[] { CodeTourSchema.Tour}), 161 | new GraphCommand(GraphCommandDefinition.Contains, new[] { CodeTourSchema.Step}, trackChanges: true), 162 | }; 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/Graph/CodeTourSchema.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.GraphModel; 2 | using Microsoft.VisualStudio.GraphModel.Schemas; 3 | 4 | namespace CodeTourVS 5 | { 6 | internal class CodeTourSchema 7 | { 8 | static CodeTourSchema() 9 | { 10 | TourToStepLink.BasedOnCategory = CodeLinkCategories.Contains; 11 | } 12 | 13 | public static GraphSchema Schema = new GraphSchema("TourSchema"); 14 | public static GraphCategory Tour = Schema.Categories.AddNewCategory("TourFile"); 15 | public static GraphCategory TourToStepLink = Schema.Categories.AddNewCategory("TourToStepLink"); 16 | public static GraphCategory Step = Schema.Categories.AddNewCategory("TourStep"); 17 | public static GraphNodeIdName StepValueName = GraphNodeIdName.Get("TourStepValueName", null, typeof(string), true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekRelationship.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Language.Intellisense; 2 | 3 | namespace CodeTourVS 4 | { 5 | public class CodeTourPeekRelationship : IPeekRelationship 6 | { 7 | public const string RelationshipName = "codetour"; 8 | public string Name => "codetour"; 9 | 10 | public string DisplayName => "Code Tour"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | 4 | namespace CodeTourVS 5 | { 6 | internal class CodeTourPeekResult : IPeekResult 7 | { 8 | public IPeekResultDisplayInfo DisplayInfo => 9 | new PeekResultDisplayInfo("Code Tour", null, "Code Tour: " + CodeTourManager.CurrentStep.Title, "Code Tour"); 10 | 11 | public bool CanNavigateTo => true; 12 | 13 | public Action PostNavigationCallback => null; 14 | 15 | public event EventHandler Disposed; 16 | 17 | public void Dispose() 18 | { 19 | Disposed?.Invoke(this, EventArgs.Empty); 20 | } 21 | 22 | public void NavigateTo(object data) 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekResultPresentation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using Microsoft.VisualStudio.Imaging; 5 | using Microsoft.VisualStudio.Language.Intellisense; 6 | using Microsoft.VisualStudio.Shell; 7 | 8 | namespace CodeTourVS 9 | { 10 | internal class CodeTourPeekResultPresentation : IPeekResultPresentation 11 | { 12 | public double ZoomLevel 13 | { 14 | get { return 1.0; } 15 | set { } 16 | } 17 | 18 | public bool IsDirty => false; 19 | 20 | public bool IsReadOnly => false; 21 | 22 | public event EventHandler RecreateContent = delegate { }; 23 | public event EventHandler IsDirtyChanged 24 | { 25 | add { } 26 | remove { } 27 | } 28 | 29 | public event EventHandler IsReadOnlyChanged 30 | { 31 | add { } 32 | remove { } 33 | } 34 | 35 | public bool CanSave(out string defaultPath) 36 | { 37 | defaultPath = null; 38 | return false; 39 | } 40 | 41 | public IPeekResultScrollState CaptureScrollState() 42 | { 43 | return null; 44 | } 45 | 46 | public void Close() 47 | { 48 | } 49 | 50 | public UIElement Create(IPeekSession session, IPeekResultScrollState scrollState) 51 | { 52 | var image = new Image(); 53 | 54 | ThreadHelper.JoinableTaskFactory.Run(async () => 55 | { 56 | image.Source = await KnownMonikers.Reference.ToImageSourceAsync(256); 57 | }); 58 | 59 | 60 | return new StepView(CodeTourManager.CurrentStep); 61 | } 62 | 63 | public void Dispose() 64 | { 65 | } 66 | 67 | public void ScrollIntoView(IPeekResultScrollState scrollState) 68 | { 69 | } 70 | 71 | public void SetKeyboardFocus() 72 | { 73 | } 74 | 75 | public bool TryOpen(IPeekResult otherResult) => false; 76 | 77 | public bool TryPrepareToClose() => true; 78 | 79 | public bool TrySave(bool saveAs) => true; 80 | } 81 | } -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekResultPresenter.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Utilities; 4 | 5 | namespace CodeTourVS 6 | { 7 | [Export(typeof(IPeekResultPresenter))] 8 | [Name("Code Tour Peek Presenter")] 9 | internal class CodeTourPeekResultPresenter : IPeekResultPresenter 10 | { 11 | public IPeekResultPresentation TryCreatePeekResultPresentation(IPeekResult result) 12 | { 13 | return result is CodeTourPeekResult ? new CodeTourPeekResultPresentation() : null; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekableItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.Language.Intellisense; 7 | using Microsoft.VisualStudio.Text; 8 | 9 | namespace CodeTourVS 10 | { 11 | public class CodeTourPeekableItem : IPeekableItem 12 | { 13 | private readonly IPeekResultFactory _peekResultFactory; 14 | private readonly Step _step; 15 | private readonly Span _span; 16 | 17 | public CodeTourPeekableItem(IPeekResultFactory peekResultFactory, Step step, Span span) 18 | { 19 | _peekResultFactory = peekResultFactory; 20 | _step = step; 21 | _span = span; 22 | } 23 | public string DisplayName => _step.Title; 24 | 25 | public IEnumerable Relationships 26 | { 27 | get 28 | { 29 | yield return new CodeTourPeekRelationship(); 30 | } 31 | } 32 | 33 | public IPeekResultSource GetOrCreateResultSource(string relationshipName) 34 | { 35 | if (relationshipName == CodeTourPeekRelationship.RelationshipName) 36 | { 37 | return new CodeTourResultSource(); 38 | } 39 | 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekableItemSource.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Microsoft; 4 | using Microsoft.VisualStudio; 5 | using Microsoft.VisualStudio.ComponentModelHost; 6 | using Microsoft.VisualStudio.Editor; 7 | using Microsoft.VisualStudio.Language.Intellisense; 8 | using Microsoft.VisualStudio.Shell; 9 | using Microsoft.VisualStudio.Text; 10 | using Microsoft.VisualStudio.Text.Editor; 11 | using Microsoft.VisualStudio.Text.Tagging; 12 | using Microsoft.VisualStudio.TextManager.Interop; 13 | 14 | namespace CodeTourVS 15 | { 16 | public class CodeTourPeekableItemSource : IPeekableItemSource 17 | { 18 | private readonly IPeekResultFactory _peekResultFactory; 19 | private readonly ITextBuffer _textBuffer; 20 | private readonly IViewTagAggregatorFactoryService _viewTagAggregatorService; 21 | 22 | public CodeTourPeekableItemSource(IPeekResultFactory peekResultFactory, ITextBuffer textBuffer, IViewTagAggregatorFactoryService viewTagAggregatorService) 23 | { 24 | _peekResultFactory = peekResultFactory; 25 | _textBuffer = textBuffer; 26 | _viewTagAggregatorService = viewTagAggregatorService; 27 | } 28 | 29 | public void AugmentPeekSession(IPeekSession session, IList peekableItems) 30 | { 31 | ThreadHelper.ThrowIfNotOnUIThread(); 32 | 33 | if (session.RelationshipName == CodeTourPeekRelationship.RelationshipName) 34 | { 35 | IWpfTextView view = GetTextView(); 36 | ITagAggregator aggregator = _viewTagAggregatorService.CreateTagAggregator(view); 37 | 38 | SnapshotPoint point = view.Caret.Position.BufferPosition.TranslateTo(_textBuffer.CurrentSnapshot, PointTrackingMode.Positive); 39 | SnapshotSpan line = point.GetContainingLine().Extent; 40 | IMappingTagSpan tag = aggregator.GetTags(line).FirstOrDefault(); 41 | 42 | if (tag != null) 43 | { 44 | var item = new CodeTourPeekableItem(_peekResultFactory, tag.Tag.Step, line.Span); 45 | peekableItems.Add(item); 46 | } 47 | } 48 | } 49 | 50 | public IWpfTextView GetTextView() 51 | { 52 | ThreadHelper.ThrowIfNotOnUIThread(); 53 | 54 | var compService = ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)) as IComponentModel; 55 | Assumes.Present(compService); 56 | 57 | IVsEditorAdaptersFactoryService editorAdapter = compService.GetService(); 58 | 59 | var textManager = ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)) as IVsTextManager; 60 | Assumes.Present(textManager); 61 | 62 | ErrorHandler.ThrowOnFailure(textManager.GetActiveView(1, null, out IVsTextView activeView)); 63 | 64 | return editorAdapter.GetWpfTextView(activeView); 65 | } 66 | 67 | public void Dispose() 68 | { 69 | 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Peek/CodeTourPeekableItemSourceProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Text; 4 | using Microsoft.VisualStudio.Text.Tagging; 5 | using Microsoft.VisualStudio.Utilities; 6 | 7 | namespace CodeTourVS 8 | { 9 | [Export(typeof(IPeekableItemSourceProvider))] 10 | [ContentType("text")] 11 | [Name(CodeTourPeekRelationship.RelationshipName)] 12 | [SupportsStandaloneFiles(true)] 13 | [Order(Before = "definition")] 14 | public class CodeTourPeekableItemSourceProvider : IPeekableItemSourceProvider 15 | { 16 | [Import] 17 | private IPeekResultFactory PeekResultFactory { get; set; } 18 | 19 | [Import] 20 | private IViewTagAggregatorFactoryService ViewTagAggregatorService { get; set; } 21 | 22 | public IPeekableItemSource TryCreatePeekableItemSource(ITextBuffer textBuffer) 23 | { 24 | return textBuffer.Properties.GetOrCreateSingletonProperty(() => new CodeTourPeekableItemSource(PeekResultFactory, textBuffer, ViewTagAggregatorService)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Peek/CodeTourResultSource.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Text; 4 | 5 | namespace CodeTourVS 6 | { 7 | public class CodeTourResultSource : IPeekResultSource 8 | { 9 | public void FindResults(string relationshipName, IPeekResultCollection resultCollection, CancellationToken cancellationToken, IFindPeekResultsCallback callback) 10 | { 11 | if (relationshipName == CodeTourPeekRelationship.RelationshipName) 12 | { 13 | resultCollection.Add(new CodeTourPeekResult()); 14 | callback.ReportProgress(1); 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Peek/StepView.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Peek/StepView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Documents; 9 | using System.Xaml; 10 | using Markdig; 11 | using Markdig.Wpf; 12 | using XamlReader = System.Windows.Markup.XamlReader; 13 | 14 | namespace CodeTourVS 15 | { 16 | /// 17 | /// Interaction logic for StepView.xaml 18 | /// 19 | public partial class StepView : UserControl 20 | { 21 | private readonly Step _step; 22 | 23 | public StepView(Step step) 24 | { 25 | InitializeComponent(); 26 | Loaded += OnLoaded; 27 | _step = step; 28 | } 29 | 30 | private static MarkdownPipeline BuildPipeline() 31 | { 32 | return new MarkdownPipelineBuilder() 33 | .UseSupportedExtensions() 34 | .Build(); 35 | } 36 | 37 | private void OnLoaded(object sender, RoutedEventArgs e) 38 | { 39 | var xaml = Markdig.Wpf.Markdown.ToXaml(_step.Description, BuildPipeline()); 40 | using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml))) 41 | { 42 | using (var reader = new XamlXmlReader(stream, new MyXamlSchemaContext())) 43 | { 44 | if (XamlReader.Load(reader) is FlowDocument document) 45 | { 46 | Viewer.Document = document; 47 | } 48 | } 49 | } 50 | } 51 | 52 | private void OpenHyperlink(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) 53 | { 54 | Process.Start(e.Parameter.ToString()); 55 | } 56 | 57 | class MyXamlSchemaContext : XamlSchemaContext 58 | { 59 | public override bool TryGetCompatibleXamlNamespace(string xamlNamespace, out string compatibleNamespace) 60 | { 61 | if (xamlNamespace.Equals("clr-namespace:Markdig.Wpf", StringComparison.Ordinal)) 62 | { 63 | compatibleNamespace = $"clr-namespace:Markdig.Wpf;assembly={Assembly.GetAssembly(typeof(Styles)).FullName}"; 64 | return true; 65 | } 66 | return base.TryGetCompatibleXamlNamespace(xamlNamespace, out compatibleNamespace); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CodeTourVS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CodeTourVS")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Build and Revision Numbers 30 | // by using the '*' as shown below: 31 | // [assembly: AssemblyVersion("1.0.*")] 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /src/Registry.pkgdef: -------------------------------------------------------------------------------- 1 | [$RootKey$\ShellFileAssociations\.tour] 2 | "DefaultIconMoniker"="KnownMonikers.HelpTableOfContents" -------------------------------------------------------------------------------- /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/CodeTourVS/b3a918cd16bae2ef2060b8fb43d622d35b970a3f/src/Resources/Icon.png -------------------------------------------------------------------------------- /src/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace CodeTourVS 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 CodeTourVSPackageString = "a139934a-4daf-44ff-af02-aa018c2ae51f"; 16 | public static Guid CodeTourVSPackage = new Guid(CodeTourVSPackageString); 17 | 18 | public const string CodeTourCmdSetString = "c0f86fe5-9b7c-4a21-8538-512aaef437fd"; 19 | public static Guid CodeTourCmdSet = new Guid(CodeTourCmdSetString); 20 | } 21 | /// 22 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 23 | /// 24 | internal sealed partial class PackageIds 25 | { 26 | public const int MyMenuGroup = 0x1020; 27 | public const int GoToStepCommand = 0x0100; 28 | } 29 | } -------------------------------------------------------------------------------- /src/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace CodeTourVS 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "9b0909ef-5ea4-4899-bacf-16c894b87ca0"; 11 | public const string Name = "Code Tour"; 12 | public const string Description = @"Code Tours shows guided tours through any source code base. They are easy to create and easy to use."; 13 | public const string Language = "en-US"; 14 | public const string Version = "1.0.4"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = ""; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Tour 6 | Code Tours shows guided tours through any source code base. They are easy to create and easy to use. 7 | Resources\LICENSE 8 | Resources\Icon.png 9 | Resources\Icon.png 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | --------------------------------------------------------------------------------