├── src ├── Resources │ └── Icon.png ├── source.extension.ico ├── InspectorPackage.cs ├── Properties │ └── AssemblyInfo.cs ├── source.extension.cs ├── source.extension1.cs ├── source.extension.vsixmanifest ├── Helpers │ └── VsHelpers.cs ├── BrowserLink │ ├── InspectMode │ │ ├── InspectModeBrowserLink.cs │ │ └── InspectModeBrowserLink.js │ └── DesignMode │ │ ├── DesignModeBrowserLink.cs │ │ └── DesignModeBrowserLink.js └── BrowserLinkInspector.csproj ├── lib ├── Microsoft.WebTools.Languages.Html.dll ├── Microsoft.WebTools.Languages.Shared.dll ├── Microsoft.WebTools.Languages.Html.Editor.dll └── Microsoft.WebTools.Languages.Shared.Editor.dll ├── .gitignore ├── CHANGELOG.md ├── .github ├── ISSUE_TEMPLATE.md └── CONTRIBUTING.md ├── .gitattributes ├── LICENSE ├── appveyor.yml ├── BrowserLinkInspector2019.sln └── README.md /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector2019/master/src/Resources/Icon.png -------------------------------------------------------------------------------- /src/source.extension.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector2019/master/src/source.extension.ico -------------------------------------------------------------------------------- /lib/Microsoft.WebTools.Languages.Html.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector2019/master/lib/Microsoft.WebTools.Languages.Html.dll -------------------------------------------------------------------------------- /lib/Microsoft.WebTools.Languages.Shared.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector2019/master/lib/Microsoft.WebTools.Languages.Shared.dll -------------------------------------------------------------------------------- /lib/Microsoft.WebTools.Languages.Html.Editor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector2019/master/lib/Microsoft.WebTools.Languages.Html.Editor.dll -------------------------------------------------------------------------------- /lib/Microsoft.WebTools.Languages.Shared.Editor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/BrowserLinkInspector2019/master/lib/Microsoft.WebTools.Languages.Shared.Editor.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 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace BrowserLinkInspector 7 | { 8 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 9 | [InstalledProductRegistration("#110", "#112", Vsix.Version)] 10 | [Guid("40d72d39-a940-40dd-b0a6-32c5563360cf")] 11 | public sealed class InspectorPackage : AsyncPackage 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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 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 | -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace BrowserLinkInspector 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "e607008b-f079-4e79-8d23-1d8c5dba1626"; 11 | public const string Name = "Browser Link Inspector 2019"; 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 | -------------------------------------------------------------------------------- /src/source.extension1.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace BrowserLinkInspector 7 | { 8 | internal sealed partial 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 | -------------------------------------------------------------------------------- /BrowserLinkInspector2019.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30203.42 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserLinkInspector", "src\BrowserLinkInspector.csproj", "{21A614C7-748E-4622-B8CB-38F0AA20D8F2}" 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 | README.md = README.md 12 | EndProjectSection 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {21A614C7-748E-4622-B8CB-38F0AA20D8F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {21A614C7-748E-4622-B8CB-38F0AA20D8F2}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {21A614C7-748E-4622-B8CB-38F0AA20D8F2}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {21A614C7-748E-4622-B8CB-38F0AA20D8F2}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {B9FCC245-C0DB-4074-A29E-68BC2B19F206} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Browser Link Inspector 2019 6 | Adds inspect and debug mode directly in the browsers 7 | https://github.com/madskristensen/browserlinkinspector2019 8 | Resources\LICENSE 9 | Resources\Icon.png 10 | Resources\Icon.png 11 | browser link 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Helpers/VsHelpers.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | 3 | using EnvDTE80; 4 | 5 | using Microsoft; 6 | using Microsoft.VisualStudio; 7 | using Microsoft.VisualStudio.ComponentModelHost; 8 | using Microsoft.VisualStudio.Editor; 9 | using Microsoft.VisualStudio.Shell; 10 | using Microsoft.VisualStudio.Text.Editor; 11 | using Microsoft.VisualStudio.TextManager.Interop; 12 | 13 | namespace BrowserLinkInspector 14 | { 15 | internal static class VsHelpers 16 | { 17 | public static DTE2 DTE => ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2; 18 | 19 | public static IWpfTextView GetCurentTextView() 20 | { 21 | ThreadHelper.ThrowIfNotOnUIThread(); 22 | IComponentModel componentModel = GetComponentModel(); 23 | if (componentModel == null) 24 | { 25 | return null; 26 | } 27 | 28 | IVsEditorAdaptersFactoryService editorAdapter = componentModel.GetService(); 29 | 30 | return editorAdapter.GetWpfTextView(GetCurrentNativeTextView()); 31 | } 32 | 33 | public static IVsTextView GetCurrentNativeTextView() 34 | { 35 | ThreadHelper.ThrowIfNotOnUIThread(); 36 | IVsTextManager textManager = (IVsTextManager)ServiceProvider.GlobalProvider.GetService(typeof(SVsTextManager)); 37 | Assumes.Present(textManager); 38 | 39 | ErrorHandler.ThrowOnFailure(textManager.GetActiveView(1, null, out IVsTextView activeView)); 40 | return activeView; 41 | } 42 | 43 | public static IComponentModel GetComponentModel() 44 | { 45 | ThreadHelper.ThrowIfNotOnUIThread(); 46 | return (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)); 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Browser Link Inspector 2019 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/qlabb1fkbck7sujb?svg=true)](https://ci.appveyor.com/project/madskristensen/browserlinkinspector2019) 4 | 5 | Download this extension from the [VS Marketplace](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BrowserLinkInspector2019) 6 | or get the [CI build](https://www.vsixgallery.com/extension/e607008b-f079-4e79-8d23-1d8c5dba1626/). 7 | 8 | --------------------------------------- 9 | 10 | Adds inspect and debug mode directly in the browsers 11 | 12 | ## Features 13 | 14 | - Inspect mode `(Ctrl+Alt+I)` 15 | - Debug mode `(Ctrl+Alt+D)` 16 | - Supports the [Web Essentials Chrome extension](https://chrome.google.com/webstore/detail/web-essentials/mghdcdlpcdiodelbplncnodiiadljhhk) 17 | 18 | ### Inspect Mode 19 | 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. 20 | 21 | ### Debug Mode 22 | 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. 23 | 24 | 25 | ## Known Issues 26 | ASP.NET Core projects are not yet supported. 27 | 28 | ## Contribute 29 | Check out the [contribution guidelines](.github/CONTRIBUTING.md) 30 | if you want to contribute to this project. 31 | 32 | For cloning and building this project yourself, make sure 33 | to install the 34 | [Extensibility Tools 2015](https://visualstudiogallery.msdn.microsoft.com/ab39a092-1343-46e2-b0f1-6a3f91155aa6) 35 | extension for Visual Studio which enables some features 36 | used by this project. 37 | 38 | ## License 39 | [Apache 2.0](LICENSE) -------------------------------------------------------------------------------- /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 | (function (browserLink, $) { 2 | /// 3 | /// 4 | 5 | var inspectModeOn = false; 6 | var inspectOverlay = null; 7 | var current; 8 | 9 | function getInspectOverlay() { 10 | if (inspectOverlay === null) { 11 | 12 | $("body").append("