Extending VS2012 Javascript Intellisense with cust

2019-07-17 21:01发布

I have created a new classes like following

[Order(Before = "High")] [Export(typeof(ICompletionSourceProvider))]
[ContentType("JavaScript"), Name("EnhancedJavaScriptCompletion")] 
internal sealed class JavaScriptCompletionSourceProvider 
   : ICompletionSourceProvider 
{ } 

And the CompletionSource

internal sealed class CompletionSource : ICompletionSource, IDisposable
{
    public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
    {
    }
    public void Dispose()
    {
    }
}

These are both Added to a Visual Studio Package project. So when I try to debug (with F5) I can see the debugging symbols are loading and the debugging stops in the

protected override void Initialize()
{
    Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
    base.Initialize();
}

However when I'm editing a .js file, and invoking the intellisense (with that . dot that is) the deubbger won't break into ICompletionSourceProvider nor ICompletionSource methods of my classes.

So my question are:

  • 1-5 Questions about standard Javascript Intellisense addressed in this screencast http://screencast.com/t/TwDlnpfOV0bX
  • 6 how can we extend the standard javascript intellisense with extra options?
  • 7 Is it possible to have two ICompletionSourceProvider classes for the same ContentType?

1条回答
【Aperson】
2楼-- · 2019-07-17 21:38

The reason your extension isn't getting composed is you haven't added it as MEF component to in your .vsixmanifest. To add it,

  1. open the .vsixmanifest designer by double clicking the file in your solution explorer.
  2. click asserts
  3. click "new" on the right-hand-side
  4. choose "Microsoft.VisualStudio.MefComponent" as the type
  5. choose "project in current solution
  6. choose your extension project
查看更多
登录 后发表回答