Visual Studio 2010 中 Javascript 中的区域/代码折叠

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2923177/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 02:31:01  来源:igfitidea点击:

Regions/code collapse in Javascript in Visual Studio 2010

javascriptvisual-studio-2010visual-studiocode-regions

提问by Mr. Flibble

Is it possible to create code regions in JS files in Visual Studio 2010?

是否可以在 Visual Studio 2010 中的 JS 文件中创建代码区域?

This methodworks in 2005, but I can't get working in 2010.

这种方法在 2005 年有效,但我无法在 2010 年开始工作。

采纳答案by Alex Yeung

Here is a very cool VS2010 extension for Javascript and CSS outlining http://jsoutlining.codeplex.com/

这是一个非常酷的 VS2010 Javascript 和 CSS 扩展概述 http://jsoutlining.codeplex.com/

回答by BrianFinkel

Microsoft now has an extension for VS2010 that provides this functionality:

微软现在为 VS2010 提供了一个扩展,它提供了这个功能:

JScript Editor Extensions

JScript 编辑器扩展

回答by Eric J.

Advanced JavaScript Outlining for Visual Studio 11 is now available for VS2012 through the Extension Manger, or at the URL

Visual Studio 11 的高级 JavaScript 大纲现在可通过扩展管理器或 URL 用于 VS2012

http://visualstudiogallery.msdn.microsoft.com/4be701d8-af03-40a4-8cdc-d2add5cde46c?SRC=VSIDE

http://visualstudiogallery.msdn.microsoft.com/4be701d8-af03-40a4-8cdc-d2add5cde46c?SRC=VSIDE

回答by Joel Harris

The JSEnhancementsplugin for Visual Studio addresses this nicely.

Visual Studio的JSEnhancements插件很好地解决了这个问题。

回答by Jamie Dixon

There's an interesting post here : http://blog.devarchive.net/2008/04/using-region-directive-with-javascript.htmlon how to do this using Macros in Visual Studio.

这里有一篇有趣的文章:http: //blog.devarchive.net/2008/04/using-region-directive-with-javascript.html关于如何在 Visual Studio 中使用宏来做到这一点。

Hope that help.

希望有所帮助。

UpdateI just realised that someone has already referenced this link in the comments.

更新我刚刚意识到有人已经在评论中引用了这个链接。

回答by kwrl

Another great Visual Studio 2012-Extension is Web Essentials 2012. There are a bunch of cool tools for even TypeScript, LESS and CoffeeScript.

另一个很棒的 Visual Studio 2012-Extension 是 Web Essentials 2012。有很多很酷的工具甚至可以用于 TypeScript、LESS 和 CoffeeScript。

http://vswebessentials.com/

http://vswebessentials.com/

回答by rcp

Even though VS extensions installed, I had a unique problem of some of the script blocks not outlining properly, later found that its because of the @Url.Contenttag used in the script, simply replaced it with simple string url, the outlining worked....thought of sharing if it helps someone

即使安装了 VS 扩展,我也有一些脚本块没有正确勾勒出的独特问题,后来发现是因为脚本中使用了@Url.Content标记,只需将其替换为简单的字符串 url,大纲就起作用了。 ...如果对某人有帮助就想分享

回答by Wolf5

In VS 2015 you can just create a block around your "region" like this

在 VS 2015 中,您可以像这样在“区域”周围创建一个块

{ //My little region
  function misc()...
  var x = '';
  //etc...
  ...
}

Then just collapse that block. Probably on all older versions of Visual Studio as well.

然后只是折叠那个块。可能也适用于所有旧版本的 Visual Studio。