I have a VSIX project that targets Visual Studio 2012 and it works fine. But when I updated the project to target Visual Studio 2013. The follow function "VsTextViewCreated" wasn't called
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using SnippetsUI;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VSIXProject1
{
class CompletionHandler
{
[Export(typeof(IVsTextViewCreationListener))]
[ContentType("CSharp")]
[Name("CodeCompletionTypeZero")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal class CompletionHandlerProvider : IVsTextViewCreationListener
{
[Import]
internal IVsEditorAdaptersFactoryService _adapterService = null;
[Import]
internal ICompletionBroker _completionBroker { get; set; }
[Import]
internal SVsServiceProvider _serviceProvider { get; set; }
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
Printer.Print("VsTextViewCreated");
ITextView textView = _adapterService.GetWpfTextView(textViewAdapter);
if (textView == null)
{
return;
}
return;
}
}
}
}
What's more, if I want to set a break point at this line: "Printer.Print("VsTextViewCreated");" I got "the breakpoint will not currently be hit. No symbols have been loaded for this document"
Thanks everyone who had read this far :)