├── src ├── Resources │ └── Icon.png ├── source.extension.ico ├── InspectorPackage.cs ├── Properties │ └── AssemblyInfo.cs ├── source.extension.cs ├── Helpers │ └── VsHelpers.cs ├── source.extension.vsixmanifest ├── packages.config ├── BrowserLink │ ├── InspectMode │ │ ├── InspectModeBrowserLink.cs │ │ └── InspectModeBrowserLink.js │ └── DesignMode │ │ ├── DesignModeBrowserLink.js │ │ └── DesignModeBrowserLink.cs ├── source.extension.resx └── BrowserLinkInspector.csproj ├── lib ├── Microsoft.Html.Core.dll ├── Microsoft.Web.Core.dll ├── Microsoft.Html.Editor.dll ├── Microsoft.VisualStudio.Web.BrowserLink.12.0.dll └── Microsoft.VisualStudio.Web.BrowserLink.12.0.xml ├── .gitignore ├── CHANGELOG.md ├── .github ├── ISSUE_TEMPLATE.md └── CONTRIBUTING.md ├── .gitattributes ├── LICENSE ├── appveyor.yml ├── BrowserLinkInspector.sln └── README.md /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector/master/src/Resources/Icon.png -------------------------------------------------------------------------------- /src/source.extension.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector/master/src/source.extension.ico -------------------------------------------------------------------------------- /lib/Microsoft.Html.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector/master/lib/Microsoft.Html.Core.dll -------------------------------------------------------------------------------- /lib/Microsoft.Web.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector/master/lib/Microsoft.Web.Core.dll -------------------------------------------------------------------------------- /lib/Microsoft.Html.Editor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector/master/lib/Microsoft.Html.Editor.dll -------------------------------------------------------------------------------- /lib/Microsoft.VisualStudio.Web.BrowserLink.12.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector/master/lib/Microsoft.VisualStudio.Web.BrowserLink.12.0.dll -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | packages 2 | 3 | # User files 4 | *.suo 5 | *.user 6 | *.sln.docstates 7 | .vs/ 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Rr]elease/ 12 | x64/ 13 | [Bb]in/ 14 | [Oo]bj/ 15 | 16 | # MSTest test Results 17 | [Tt]est[Rr]esult*/ 18 | [Bb]uild[Ll]og.* 19 | 20 | # NCrunch 21 | *.ncrunchsolution 22 | *.ncrunchproject 23 | _NCrunch_WebCompiler -------------------------------------------------------------------------------- /src/InspectorPackage.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | using System; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace BrowserLinkInspector 6 | { 7 | [PackageRegistration(UseManagedResourcesOnly = true)] 8 | [InstalledProductRegistration("#110", "#112", Vsix.Version, IconResourceID = 400)] 9 | [Guid("40d72d39-a940-40dd-b0a6-32c5563360cf")] 10 | public sealed class InspectorPackage : Package 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Road map 2 | 3 | - [ ] Nothing yet... 4 | 5 | Features that have a checkmark are complete and available for 6 | download in the 7 | [CI build](http://vsixgallery.com/extension/bc4780ab-de6e-4999-bebf-51390e1b75ef/). 8 | 9 | # Change log 10 | 11 | These are the changes to each version that has been released 12 | on the official Visual Studio extension gallery. 13 | 14 | ## 1.0 15 | 16 | - [x] Initial release 17 | - [x] Inspect mode 18 | - [x] Design mode -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Installed product versions 2 | - Visual Studio: [example 2015 Professional] 3 | - This extension: [example 1.1.21] 4 | 5 | ### Description 6 | Replace this text with a short description 7 | 8 | ### Steps to recreate 9 | 1. Replace this 10 | 2. text with 11 | 3. the steps 12 | 4. to recreate 13 | 14 | ### Current behavior 15 | Explain what it's doing and why it's wrong 16 | 17 | ### Expected behavior 18 | Explain what it should be doing after it's fixed. -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2016 Mads Kristensen 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using BrowserLinkInspector; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle(Vsix.Name)] 6 | [assembly: AssemblyDescription(Vsix.Description)] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany(Vsix.Author)] 9 | [assembly: AssemblyProduct(Vsix.Name)] 10 | [assembly: AssemblyCopyright(Vsix.Author)] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: AssemblyVersion(Vsix.Version)] 17 | [assembly: AssemblyFileVersion(Vsix.Version)] 18 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 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 | -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by Extensibility Tools v1.10.211 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace BrowserLinkInspector 7 | { 8 | static class Vsix 9 | { 10 | public const string Id = "bc4780ab-de6e-4999-bebf-51390e1b75ef"; 11 | public const string Name = "Browser Link Inspector 2017"; 12 | public const string Description = @"Adds inspect and debug mode directly in the browsers"; 13 | public const string Language = "en-US"; 14 | public const string Version = "0.5"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = "browser link"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BrowserLinkInspector.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.9 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserLinkInspector", "src\BrowserLinkInspector.csproj", "{21A614C7-748E-4622-B8CB-38F0AA20D8F1}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3B23DBEC-2D6D-4367-A54A-5AB50788BB6A}" 9 | ProjectSection(SolutionItems) = preProject 10 | appveyor.yml = appveyor.yml 11 | CHANGELOG.md = CHANGELOG.md 12 | README.md = README.md 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {21A614C7-748E-4622-B8CB-38F0AA20D8F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {21A614C7-748E-4622-B8CB-38F0AA20D8F1}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {21A614C7-748E-4622-B8CB-38F0AA20D8F1}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {21A614C7-748E-4622-B8CB-38F0AA20D8F1}.Release|Any CPU.Build.0 = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /src/Helpers/VsHelpers.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using EnvDTE80; 3 | using Microsoft.VisualStudio; 4 | using Microsoft.VisualStudio.ComponentModelHost; 5 | using Microsoft.VisualStudio.Editor; 6 | using Microsoft.VisualStudio.Shell; 7 | using Microsoft.VisualStudio.Text.Editor; 8 | using Microsoft.VisualStudio.TextManager.Interop; 9 | 10 | namespace BrowserLinkInspector 11 | { 12 | internal static class VsHelpers 13 | { 14 | public static DTE2 DTE => ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2; 15 | 16 | public static IWpfTextView GetCurentTextView() 17 | { 18 | var componentModel = GetComponentModel(); 19 | if (componentModel == null) return null; 20 | var editorAdapter = componentModel.GetService(); 21 | 22 | return editorAdapter.GetWpfTextView(GetCurrentNativeTextView()); 23 | } 24 | 25 | public static IVsTextView GetCurrentNativeTextView() 26 | { 27 | var textManager = (IVsTextManager)ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)); 28 | 29 | IVsTextView activeView = null; 30 | ErrorHandler.ThrowOnFailure(textManager.GetActiveView(1, null, out activeView)); 31 | return activeView; 32 | } 33 | 34 | public static IComponentModel GetComponentModel() 35 | { 36 | return (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Browser Link Inspector 2017 6 | Adds inspect and debug mode directly in the browsers 7 | https://github.com/madskristensen/browserlinkinspector 8 | Resources\LICENSE 9 | https://github.com/madskristensen/BrowserLinkInspector/blob/master/CHANGELOG.md 10 | Resources\Icon.png 11 | Resources\Icon.png 12 | browser link 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Browser Link Inspector 2017 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/ix60r69heymrn69f?svg=true)](https://ci.appveyor.com/project/madskristensen/browserlinkinspector) 4 | 5 | Download this extension from the [VS Marketplace](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BrowserLinkInspector2017) 6 | or get the [CI build](http://vsixgallery.com/extension/bc4780ab-de6e-4999-bebf-51390e1b75ef/). 7 | 8 | --------------------------------------- 9 | 10 | Adds inspect and debug mode directly in the browsers 11 | 12 | See the [change log](CHANGELOG.md) for changes and road map. 13 | 14 | ## Features 15 | 16 | - Inspect mode `(Ctrl+Alt+I)` 17 | - Debug mode `(Ctrl+Alt+D)` 18 | - Supports the [Web Essentials Chrome extension](https://chrome.google.com/webstore/detail/web-essentials/mghdcdlpcdiodelbplncnodiiadljhhk) 19 | 20 | ### Inspect Mode 21 | This mode will put the browser in a state where hovering the various DOM elements in the Browser will open the corresponding file in Visual Studio and select the range that produced the DOM element. 22 | 23 | ### Debug Mode 24 | Does the same as Inspect Mode as well as put the document in edit mode. It is then possible to make text changes directly in the browser and see the changes persisted back into the source file in Visual Studio in real time. 25 | 26 | 27 | ## Known Issues 28 | ASP.NET Core projects are not yet supported. 29 | 30 | ## Contribute 31 | Check out the [contribution guidelines](.github/CONTRIBUTING.md) 32 | if you want to contribute to this project. 33 | 34 | For cloning and building this project yourself, make sure 35 | to install the 36 | [Extensibility Tools 2015](https://visualstudiogallery.msdn.microsoft.com/ab39a092-1343-46e2-b0f1-6a3f91155aa6) 37 | extension for Visual Studio which enables some features 38 | used by this project. 39 | 40 | ## License 41 | [Apache 2.0](LICENSE) -------------------------------------------------------------------------------- /src/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/BrowserLink/InspectMode/InspectModeBrowserLink.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.IO; 5 | using Microsoft.VisualStudio.Web.BrowserLink; 6 | 7 | namespace BrowserLinkInspector 8 | { 9 | [Export(typeof(IBrowserLinkExtensionFactory))] 10 | public class InspectModeFactory : IBrowserLinkExtensionFactory 11 | { 12 | public BrowserLinkExtension CreateExtensionInstance(BrowserLinkConnection connection) 13 | { 14 | return new InspectMode(); 15 | } 16 | 17 | public string GetScript() 18 | { 19 | using (Stream stream = GetType().Assembly.GetManifestResourceStream("BrowserLinkInspector.BrowserLink.InspectMode.InspectModeBrowserLink.js")) 20 | using (StreamReader reader = new StreamReader(stream)) 21 | { 22 | return reader.ReadToEnd(); 23 | } 24 | } 25 | } 26 | 27 | public class InspectMode : BrowserLinkExtension 28 | { 29 | private BrowserLinkConnection _connection; 30 | private static InspectMode _instance; 31 | 32 | public override void OnConnected(BrowserLinkConnection connection) 33 | { 34 | _connection = connection; 35 | 36 | DisableInspectMode(); 37 | } 38 | 39 | public override void OnDisconnecting(BrowserLinkConnection connection) 40 | { 41 | DisableInspectMode(); 42 | } 43 | 44 | public override IEnumerable Actions 45 | { 46 | get 47 | { 48 | yield return new BrowserLinkAction("Inspect Mode", InitiateInspectMode); 49 | } 50 | } 51 | 52 | private void InitiateInspectMode(BrowserLinkAction ction) 53 | { 54 | Browsers.Client(_connection).Invoke("setInspectMode", true); 55 | 56 | _instance = this; 57 | } 58 | 59 | public static void Select(string sourcePath, int position) 60 | { 61 | if (IsInspectModeEnabled) 62 | { 63 | _instance.Browsers.Client(_instance._connection).Invoke("select", sourcePath, position); 64 | } 65 | } 66 | 67 | public static bool IsInspectModeEnabled 68 | { 69 | get { return _instance != null; } 70 | } 71 | 72 | 73 | [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] 74 | [BrowserLinkCallback] 75 | public void SetInspectMode() 76 | { 77 | _instance = this; 78 | } 79 | 80 | [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] 81 | [BrowserLinkCallback] 82 | public void DisableInspectMode() 83 | { 84 | _instance = null; 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/BrowserLink/InspectMode/InspectModeBrowserLink.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | (function (browserLink, $) { 5 | /// 6 | /// 7 | 8 | var inspectModeOn = false; 9 | var inspectOverlay = null; 10 | var current; 11 | 12 | function getInspectOverlay() { 13 | if (inspectOverlay === null) { 14 | 15 | $("body").append("