問題描述
是否可以在 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 代碼的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!