lamar.blogg.se

Solution explorer visual studio 2017 shortcut key
Solution explorer visual studio 2017 shortcut key













public KeyBindingCommandFilter(IWpfTextView textView) private IWpfTextView m_textView Īdd a constructor that sets the text view. internal class KeyBindingCommandFilter : IOleCommandTargetĪdd private fields for the text view, the next command in the command chain, and a flag to represent whether the command filter has already been added. The class named KeyBindingCommandFilter should inherit from IOleCommandTarget. The command filter is an implementation of IOleCommandTarget, which handles the command by instantiating the adornment.Īdd a class file and name it KeyBindingCommandFilter.Īdd the following using directives. Define the command filter (prior to Visual Studio 2017 version 15.6) The next two sections demonstrate how to handle a command using both the legacy and modern approach.

solution explorer visual studio 2017 shortcut key

Visual Studio 2017 version 15.6 introduced a modern simplified approach based on editor command handlers. Prior to Visual Studio 2017 version 15.6 the only way to handle commands in an editor extension was implementing an IOleCommandTarget based command filter. Public AdornmentLayerDefinition editorAdornmentLayer In the KeyBindingTestTextViewCreationListener.cs class file, change the name of the AdornmentLayer from KeyBindingTest to PurpleCornerBox: This.layer = view.GetAdornmentLayer("PurpleCornerBox") Inside the constructor, change the name of the adornment layer from KeyBindingTest to PurpleCornerBox: Use the light bulb that appears in the left margin to make the other appropriate changes.

solution explorer visual studio 2017 shortcut key

In the KeyBindingTest class file, change the class name to PurpleCornerBox. For more information, see Create an Extension with an Editor Item Template.Īdd the following references and set CopyLocal to false: (In the New Project dialog, select Visual C# / Extensibility, then VSIX Project.) Name the solution KeyBindingTest.Īdd an Editor Text Adornment item template to the project and name it KeyBindingTest. Create a Managed Extensibility Framework (MEF) ProjectĬreate a C# VSIX project. For more information, see Install the Visual Studio SDK. You can also install the VS SDK later on. It's included as an optional feature in Visual Studio setup.

solution explorer visual studio 2017 shortcut key

Starting in Visual Studio 2015, you don't install the Visual Studio SDK from the download center. This walkthrough is based on the viewport adornment editor template, and it allows you to add the adornment by using the + character. The following walkthrough shows how to add a view adornment to a text view by using a shortcut key.

solution explorer visual studio 2017 shortcut key

You can respond to shortcut keys in your editor extension. Applies to: Visual Studio Visual Studio for Mac Visual Studio Code















Solution explorer visual studio 2017 shortcut key