使用 Visual Studio (2010) 在 JavaScript 中编程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6548992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
programming in javascript with Visual Studio (2010)?
提问by T. Webster
Whether you are forced to code javascript in Visual Studio 2010, or insiston using Visual Studio 2010 instead of another IDE, I'm wondering what anyone has done to improve the javascript development experience in VS2010.
无论您是被迫在 Visual Studio 2010 中编写 javascript 代码,还是坚持使用 Visual Studio 2010 而不是其他 IDE,我想知道有人做了什么来改善 VS2010 中的 javascript 开发体验。
I'm asking since javascript support is lacking in Visual Studio 2010. You don't get the the kind of support you get as if you were developing Silverlight apps in C# and XAML. For example, the intellisense doesn't support javascript 1.8.5 (or even 1.6 functions i.e. JSON.Parse), it's difficult to navigate to function or object definitions (no Go To Definition), no Object Browser, Call Hierarchy, and the list can go on.
我之所以这么问,是因为 Visual Studio 2010 中缺少 javascript 支持。您无法获得那种支持,就像在 C# 和 XAML 中开发 Silverlight 应用程序一样。例如,智能感知不支持 javascript 1.8.5(甚至 1.6 函数,即 JSON.Parse),很难导航到函数或对象定义(没有转到定义),没有对象浏览器,调用层次结构和列表可以继续。
What have youdone to compensate for the VS2010 features that don't exist for javascript? Also, what would be a good feature request to support javascript development; anything that VS2010 should add as an extension or a future release? Also, are there any suggestions to manage the .js code for large projects?
你做了什么来弥补 JavaScript 不存在的 VS2010 功能?另外,支持javascript开发的好的功能请求是什么?VS2010 应该添加什么作为扩展或未来版本?另外,是否有任何建议来管理大型项目的 .js 代码?
A few things that have helped meso far are the JScript Editor Extensions, and the Web Standards Update. Also, when working in .js files I rely on bookmarks to get back to key places, since the functions of the file aren't visible (as the would be in C#). My feature request would be to add intellisense support by javascript version, similar to how you can target .NET 2.0, 3.5, or 4.0.
到目前为止,对我有帮助的一些东西是 JScript 编辑器扩展和Web 标准更新。此外,在 .js 文件中工作时,我依靠书签返回关键位置,因为文件的功能不可见(就像在 C# 中一样)。我的功能请求是通过 javascript 版本添加智能感知支持,类似于您如何定位 .NET 2.0、3.5 或 4.0。
采纳答案by Jamie Treworgy
There are a number of VS extensions to assist with javascript:
有许多 VS 扩展可以帮助使用 javascript:
Visual Studio Javascript extensions feature comparison
Visual Studio Javascript 扩展功能比较
JSEnhancements is awesome, and does what you really want: adds regions and code block collapsing.
JSEnhancements 很棒,可以做你真正想要的:添加区域和代码块折叠。
Also see this extension: http://code.google.com/p/js-addin/
另请参阅此扩展程序:http: //code.google.com/p/js-addin/
which parses your script into an object tree that can be used for navigation.
它将您的脚本解析为可用于导航的对象树。
I have also used the free version of this editor: http://www.yaldex.com/JSFactory_Pro.htm
我也用过这个编辑器的免费版本:http: //www.yaldex.com/JSFactory_Pro.htm
I can't recommend it, unfortunately, because it suffers from a couple critical problems (awkward UI, freaky intellisense, and not entirely stable). Which is too bad because it's a very thoughtfully designed piece of software by and large, it just fails where the rubber meets the road.
不幸的是,我不能推荐它,因为它存在几个关键问题(难看的用户界面、怪异的智能感知和不完全稳定)。这太糟糕了,因为它基本上是一款设计非常周到的软件,它只是在橡胶遇到道路的地方失败了。
回答by RoelF
回答by Raoul
While I use vim and Notepad++ to cut code, I feel your pain, or did until I started using Firebug to debug JavaScript. While it many not be exactly fitting for your situation it's invaluable to me in developing Web based apps:
当我使用 vim 和 Notepad++ 来削减代码时,我感受到了你的痛苦,或者直到我开始使用 Firebug 来调试 JavaScript。虽然它很多并不完全适合您的情况,但在开发基于 Web 的应用程序时对我来说是无价的: