问题标签 [ntvs]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - Sharing classes between multiple TypeScript files using Node.JS Tools for Visual Studio
I am currently working on a Node.JS project written in TypeScript using Node.JS Tools for Visual Studio (NTVS). I have a few classes and enums spread out in 3 or 4 files in my project. I am now trying to use the classes defined in those files from my main app file. From my previous work with Node, I know that I would normally need a require
call to import each other file/class if I were working with a text editor and the command-line compiler. But, if I open any TypeScript file in my project and start typing the name of a class defined in a different file, Visual Studio shows IntelliSense autocomplete for the class name and its members. This makes me think that the NTVS and/or TypeScript configuration are automatically making all of my classes available project-wide. But if I click the 'run' button, errors are printed to the console because Node can't find the referenced classes at runtime.
This behavior leads me to believe that IntelliSense isn't actually telling me that the classes are available, just that they exist (which seems odd). If I add a require
call to the top of the file, and use that imported value instead of the original class name, Node finds the class and I can use it in my code. But this presents two problems:
- I must come up with a new name to use for the variable that I import the class into. If I
require()
it with the original name, Visual Studio shows errors saying that the identifier is a duplicate, because it seems to believe that the original class is available project-wide. - I don't get the autocomplete or type checking in my usage of the class. This pretty much defeats the purpose of using TypeScript.
So, what's the proper way to do this import? Is there a way to make all my classes available globally? If not, what import statements do I need?
javascript - 在 Visual Studio 2015 + Node.js 中显示 JavaScript 文件的导航栏
Visual Studio 2015 为 Javascript 开发人员推出了一项新功能(?):导航栏在代码编辑器上方的 2 个选择框中列出了对象及其方法(就像多年来使用 C++ 源代码一样)。
不幸的是,我只能在 ASP.NET 项目中看到这个导航栏。当我创建一个 Node.js 项目时,导航栏消失了!
有人设法在 Javascript / Node.js 项目中使用导航栏吗?或者,是否有等效的应用程序或 VS 扩展来完成这项工作?
该栏可以在菜单工具/选项.../文本编辑器/Javascript 和 Node.js 中激活(或不激活!)
预先感谢您的帮助。
(我通过“客户反馈”程序直接询问了 MS,但不希望得到快速答复。添加对 require.js 的引用也不起作用。)
javascript - 在 Node Tools Visual Studio (NTVS) 中调试单元测试
是否可以使用 Visual Studio 节点工具调试 mocha 单元测试?我可以使用命令行命令 mocha 运行我所有的 mocha 测试。-- 但目前无法调试这些单元测试。有什么方法可以完全在 Visual Studio 中调试单元测试,甚至根本没有?
node.js - 无法安装深层嵌套节点 js 模块
我正在尝试将噩梦模块安装到我的项目中,但我遇到了一些问题。
当我运行npm install nightmare --save
它时,一切正常,npm 返回 OK,但 Visual Studios 说我达到了最大字符限制,因为噩梦深度嵌套的依赖项。项目已经处于最短路径,但模块仍然超过字符限制。
我正在运行 windows 10 x64 位、node v 4.1.0、npm 2.14.3、Visual Studios 2015 社区和 NTVS 1.0。
我知道这是一个常见的错误,我在网上搜索了它,但找不到合适的解决方案。非常感谢帮助
干杯!
node.js - 什么是 .ntvs_analysis.dat
我正在为 Visual Studio 使用 Node.js 工具。
当我打开一个项目时,加载需要一些时间,因为 Node.js 分析过程。
另一个问题是 .ntvs_analysis.dat 越来越大?
它是什么,我需要它吗?
visual-studio - 有没有办法使用 Visual Studio 中的 WinSCP 将文件传输到目标 (Linux) 设备
是否可以将 WinSCP(或同等产品)与 Visual Studio 2015 集成,以便我的任何节点编辑都可以首先传输到我的目标 Linux(嵌入式)设备,然后启动远程调试会话(使用 NTVS 的 RemoteDebug.js)?
我使用 WinSCP 或通过 git repo 执行此过程的手动版本。我希望我可以发布到嵌入式目标并从 Visual Studio 中开始调试。
node.js - 如何使用 Node Tools for Visual Studio 调试 Gulp 任务?
我最近为 Visual Studio 安装了 NodeJS 工具,它吹捧 VS 中对 Node 环境的支持。值得注意的是,它能够从 IDE 设置调试断点。
我不清楚在调试 Gulp 任务时是否可以设置断点。Task Runner 能够检测 Gulp 任务并将console.log
语句输出到窗口,但我还没有找到更好的调试方法。
我不久前发现了这篇文章:如何在使用 Visual Studio Task Runner Explorer 运行 gulpfile.js 时对其进行调试?但是,这篇文章不涉及 VS 的 NodeJS 工具。所以,我重新提出这个问题以考虑该插件。
visual-studio - 使用 Visual Studio 2015 社区进行 Nodeunit 测试(已安装 NTVS)
我想知道是否有任何工具可以让我在 Visual Studio Community 2015 中测试和运行 nodeunit 测试(安装了 Node 工具)。我听说过 VsNodeTest,但它与 Visual Studio 2015 不兼容。我有什么工具或方法可以做到这一点吗?此外,测试在 typeScript 中。感谢您的帮助,路易斯
typescript - “AssignTargetPath”任务意外失败
在使用 Node Tools for Visual Studio(v1.1,不再是 RC)构建/调试我的 Node 项目时,我突然遇到了这个错误。我使用的是 Visual Studio Community Edition 2015 。我使用 Typescript,并且还有当前最新版本的 Typescript,例如 v1.7.6。
错误:
检查互联网时,问题似乎与 Node/npm 的 MAXPATH 问题有关。 http://visual2073.rssing.com/chan-25873606/all_p116.html https://nodejstools.codeplex.com/workitem/759 https://nodejstools.codeplex.com/workitem/1340
node.js - Visual Studio 2015:错误将 TestFramework 设置为 Mocha 以用于 NodeJS 项目中的单元测试文件
我正在 Visual Studio(2015 社区版)中使用 Mocha 构建服务器端单元测试的 Typescript 项目。
然而,我读到 NodeJS Tools 支持在 VS Test Runner 中运行,甚至支持 Typescript 单元测试。您必须将文件的 TestFramework 属性设置为“Mocha”。我正在从事的项目甚至已经有为此设置的现有测试。但是我在 GUI 中没有设置它的下拉选项,它只是空的:
我正在使用 NTVS v1.1(和 Typescript 1.7)。我的 Visual Studio 设置中是否缺少某些内容?测试 .ts 文件的构建类型也已设置为TypeScriptCompile
. 也许更多的是特定的 VS 问题而不是编程问题,但是环境/工具是如此特定于程序员,以至于我认为这里有人可以帮助我。
PS 每次手动运行测试都让我发疯,我在使用我首先尝试的 HTML 规范运行器时遇到了太多问题,因为这个服务器端测试(例如 CommonJS 需要和我的浏览器没有得到的导入语句)和也因为它是 TypeScript。
但也欢迎替代解决方案。我正在使用 grunt 并且也有使用 Gulp 的经验,我只是希望有一个完整的解决方案,而不是花费我半天时间一起编写脚本、调试和记录的东西。
注意:我确实得到了为 .js 文件选择Mocha
Testframework 的下拉列表(在包含在 VS 项目中之后),但不是为 .ts 文件:S。