在Visual Studio中调试/导航JS代码 [英] Debugging/Navigating JS Code in Visual Studio

查看:330
本文介绍了在Visual Studio中调试/导航JS代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何要在 Visual Studio 中的 Javascript 文件中启用 f12 查找所有引用?我正在使用 requireJS 在我的SPA中注册js文件。我也在使用 BackboneJS

Is there anyway to enable f12 or find all references across Javascript files in Visual Studio? I'm using requireJS to register the js files in my SPA. I'm using BackboneJS as well.

在Visual Studio中翻阅相关代码的任何提示,就像我可以使用C#/ .net代码一样?我在网上搜索并自己调查但找不到任何东西。

Any tips for flipping through relavent code in Visual Studio like I can with C#/.net code? I've searched around online and investigated myself but couldn't find anything.

谢谢

推荐答案

要启用F12导航到另一个.js文件中定义的JS函数源,您需要将以下行添加到当前.js文件的顶部,在该文件中引用外部函数:

to enable F12 navigation to JS function source defined in another .js file you need to add the following line to the top of the current .js file where you reference the external function:

/// <reference path="../Path/To/The/Referenced/file.js" />

../部分是可选的,只需自己构建正确的路径。添加上面的块后,Visual Studio成功找到F12命中其外部js函数的定义。至少它适用于VS2013 Premium。

The ../ part is optional, just build the correct path yourself. After the above chunk is added Visual Studio successfully finds the definition of the external js function upon F12 hit on its reference. At least it works for me with VS2013 Premium.

这篇关于在Visual Studio中调试/导航JS代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆