JavaScript 外部库的 IntelliSense 在 Visual Studio 2015 Update 3 中不起作用

JavaScript IntelliSense for external library is not working in Visual Studio 2015 Update 3

我正在尝试在 Visual Studio 2015 Update 3 中使用 Azure Document DB 服务器端 JavaScript IntelliSense。

我已将 .js 文件从文档数据库 GitHub site 下载到我的 Visual Studio JavaScript 参考文件夹中:

并在我的 .js 文件中引用了它,但我没有看到任何 Document DB IntelliSense:

但是,如果我在 VS 中打开 DocDbWrapperScript.js,IntelliSense 开始工作:

我是不是在某处遗漏了某些配置以使 /// <reference path="foo.js" /> 语法起作用?

这应该可以,请确保路径正确。

您也可以尝试在General部分注册docdbwrapperscript.js:Tools->Options->Text Editor->JavaScript->Intellisense->References,ReferenceGroup = Generic,添加路径到 docdbwrapperscript.js 那里。

谢谢!

来自 MSDN docs(强调我的):

The following rules apply to a reference directive:

  • The reference XML comment must be declared before any script.
  • You must use XML comments syntax with three slashes. References made by using standard comments syntax (two slashes) are ignored.
  • Only one file or resource can be specified per directive.
  • Multiple references to page-based scripts are not allowed.
  • If a page reference is specified, no other type of reference directives is allowed.
  • File names use relative paths. You can use the tilde operator (~) to make application-root-relative paths.
  • Absolute paths are ignored.
  • Reference directives in referenced pages will not be processed—that is, reference directives are not resolved recursively for pages.
  • Only script that is referenced directly by the page is included.

切换到使用 /// <reference path="..." /> 中的相对路径为我修复了 IntelliSense。