5

Is anyone aware of a way to have VIM style folding in Visual Studio? I use #region blocks in c# class files and they're great, but unfortunately there's no equivalent functionality for javascript and css. The site/app I'm currently working on has a rather lot of css selectors and javascript and navigating the monolithic files is becoming difficult.

One option that we've considered is breaking up the css and javascript into separate files similiar to jquery modules, but then that introduces performance problems in terms of increasing the overall number of http requests.

If anyone has any suggestions for managing the madness, I'd be greatly appreciative!

Update: Richard Kimber suggests using the bookmarking features of visual studio to make navigating by headings more manageable. This is a step in the right direction, but not as useful as code folding/blocking.

Bayard Randel
  • 9,930
  • 3
  • 42
  • 46

3 Answers3

4

I found a Microsoft extension that improved the JavaScript text editor for Visual Studio 2010.

http://visualstudiogallery.msdn.microsoft.com/en-us/872d27ee-38c7-4a97-98dc-0d8a431cc2ed

I have used it, and it gives all of the following for JavaScript files:

  • Brace Matching
  • Outlining / Code-folding
  • Current Word Highlighting
  • IntelliSense Doc-Comments Support
Neil N
  • 24,862
  • 16
  • 85
  • 145
Brian Grinstead
  • 3,480
  • 5
  • 29
  • 23
1

I know I'm not really helping with this one, but have you heard of ViEmu. It is a, lets say, vim emulation within VS. Although it does not support all of vim's features, it does bring a flavor of it to VS navigation. I haven't used it myself, but others talk pretty good of it, so you might want to give it a shot.

Rook
  • 60,248
  • 49
  • 165
  • 242
  • This looks really interesting and it does in fact support Vim style folding. – Bayard Randel Mar 17 '09 at 22:29
  • I've actually started using GVIm in the interim until I an look at buying a copy of ViEmu :) Thanks ldigas! – Bayard Randel Mar 18 '09 at 00:25
  • I use ViEmu, and it is very handy in CSS files. You can create and manage folds with the familiar zf, zo, zR, zM, etc., but unfortunately there is not currently a way to persist those folds once the file has been closed. I've messed with ViEmu macros to create the folds automatically, with some success in the past. – Jay Jul 07 '09 at 15:21
0

I am currently using JScript Editor Extensions as Brian Grinstead suggested. If it supports region folding, I haven't figured out how. It does support function folding in JavaScript.

There are also JSEnhancements and JSOutlining. Haven't tried either of those though.

This issue is a partial duplicate of this and this.

Community
  • 1
  • 1
rstackhouse
  • 2,238
  • 24
  • 28