Debugging/Navigating JS Code in Visual Studio(在 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 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Visual Studio 中调试/导航 JS 代码


- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01