Extending VS2012 Javascript Intellisense with custom ICompletionSourceProvider

别等时光非礼了梦想. 提交于 2019-12-11 01:45:12

问题


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:


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


来源:https://stackoverflow.com/questions/15657525/extending-vs2012-javascript-intellisense-with-custom-icompletionsourceprovider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!