本文介绍了使用自定义ICompletionSourceProvider扩展VS2012 Javascript Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的类,如下所示

I have created a new classes like following

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

CompletionSource

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

这些都已添加到Visual Studio Package项目中.因此,当我尝试使用F5调试时,可以看到调试符号正在加载,并且调试在

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();
}

但是,当我编辑.js文件并调用智能感知(即带有.的点)时,deubbger不会打入类的ICompletionSourceProviderICompletionSource方法.

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.

所以我的问题是:

  • 1-5此截屏视频中有关标准Java Intellisense的问题 http://screencast.com/t/TwDlnpfOV0bX
  • 6如何通过附加选项扩展标准javascript智能感知?
  • 7是否可以为同一个ContentType使用两个ICompletionSourceProvider类?
  • 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?

推荐答案

扩展未组合的原因是您尚未将其作为MEF组件添加到.vsixmanifest中.要添加它,

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. 通过在解决方案资源管理器中双击文件来打开.vsixmanifest设计器.
  2. 点击断言
  3. 点击右侧的新建"
  4. 选择"Microsoft.VisualStudio.MefComponent"作为类型
  5. 选择当前解决方案中的项目"
  6. 选择您的扩展项目

这篇关于使用自定义ICompletionSourceProvider扩展VS2012 Javascript Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:06