How to do region collapse for JS in Visual Studio 2012/2013

谁说我不能喝 提交于 2019-12-03 11:14:56

问题


Region code collapse for JS in Visual Studio 2012 and 2013 ?

#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 ?


回答1:


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



回答2:


It worked for me after installing the Visual Studio Advanced Javascript Outlining extension.

You can find the extension here

After installing the extension just restart your Visual Studio and you can use it like this

//#region MyRegion

Code Here

//#endregion 



回答3:


  1. select the javascript code you want to hide 2.Press (

a.Ctrl+M

then

b.Ctrl+H ) then you can can name you region




回答4:


if you use Web Essentials in Visual Studio than you can write

//#region AutoComplete JS
youcode
//#endregion

see this link




回答5:


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.



来源:https://stackoverflow.com/questions/26881824/how-to-do-region-collapse-for-js-in-visual-studio-2012-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!