Enables the Razor Document Tracker

This enables the tracking of events that change the 'razor' state of a
document that's open in the editor.

Also fixed a crash that can occur when creating a new project with the
Razor Info window open.
This commit is contained in:
Ryan Nowak 2017-07-31 17:27:04 -07:00
parent 4fcad1548e
commit 5161ebaf8a
2 changed files with 5 additions and 2 deletions

View File

@ -16,8 +16,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor
{
[ContentType(RazorLanguage.ContentType)]
[TextViewRole(PredefinedTextViewRoles.Editable)]
//[Export(typeof(IWpfTextViewConnectionListener))] - we're not exporting this interface because we only want it to be hooked up
// in developer mode.
[Export(typeof(IWpfTextViewConnectionListener))]
[Export(typeof(TextViewRazorDocumentTrackerService))]
internal class DefaultTextViewRazorDocumentTrackerService : TextViewRazorDocumentTrackerService, IWpfTextViewConnectionListener
{

View File

@ -63,6 +63,10 @@ namespace Microsoft.VisualStudio.RazorExtension.DocumentInfo
private void OnBeforeDocumentWindowShow(IVsWindowFrame frame)
{
var vsTextView = VsShellUtilities.GetTextView(frame);
if (vsTextView == null)
{
return;
}
var textView = _adapterFactory.GetWpfTextView(vsTextView);
if (textView != null && textView != _textView)