Javascript 如何在 Visual Studio 2012/2013 中为 JS 进行区域折叠
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26881824/
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
How to do region collapse for JS in Visual Studio 2012/2013
提问by TheMuyu
Region code collapse for JS in Visual Studio 2012 and 2013 ?
Visual Studio 2012 和 2013 中 JS 的区域代码折叠?
#region AutoComplete JS
$("#<%=txtBirim.ClientID %>").autocomplete({
source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/Classlar/TextboxOtomatik.asmx/BirimGetir") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
Code....
#endregion
Is there anyway to do something like this ?
反正有做这样的事情吗?
回答by Pandiyan Cool
Install web essentials
安装网络必需品
Use the same name in end region
在结束区域使用相同的名称
//#region AutoComplete JS
$("#<%=txtBirim.ClientID %>").autocomplete({
source: function(request, response) {
$.ajax({
url: '<%=ResolveUrl("~/Classlar/TextboxOtomatik.asmx/BirimGetir") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function(data) {
response($.map(data.d, function(item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
Code....
//#endregion AutoComplete JS
回答by prem
It worked for me after installing the Visual Studio Advanced Javascript Outliningextension.
安装 Visual Studio Advanced Javascript Outlining扩展后,它对我有用。
You can find the extension here
您可以在此处找到扩展程序
After installing the extension just restart your Visual Studio and you can use it like this
安装扩展后只需重新启动您的 Visual Studio,您就可以像这样使用它
//#region MyRegion
Code Here
//#endregion
回答by Umair Ghouri
- select the javascript code you want to hide 2.Press (
- 选择要隐藏的 javascript 代码 2.按 (
a.Ctrl+M
a.Ctrl+M
then
然后
b.Ctrl+H ) then you can can name you region
b.Ctrl+H ) 然后你可以命名你的区域
回答by Oleg Alekseenko
回答by Jahid
Visual Studio: Just select the code area you want to collapse then right click on the mouse, click on Outlining then click on Hide Selection. You will get the collapse (+) sign on the left vertical bar. The Shortcut Key is Ctrl+M then Ctrl+H after selection.
Visual Studio:只需选择要折叠的代码区域,然后右键单击鼠标,单击“大纲”,然后单击“隐藏选择”。您将在左侧垂直条上看到折叠 (+) 符号。选择后快捷键是 Ctrl+M,然后是 Ctrl+H。

