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

查看:26
本文介绍了在 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.

有什么技巧可以像我使用 C#/.net 代码一样在 Visual Studio 中翻阅相关代码?我在网上搜索并调查了自己,但找不到任何东西.

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天全站免登陆