Future Focus: Document Map Margin


We are continuing our series of posts about proposed features for the next version of Visual Studio. This post focuses on a new feature called Document Map Margins (DMM). Developers frequently work with huge source files that are difficult to navigate. The proposed DMM feature is designed to make it easier for you to find and track important features in your code and to visualize the overall structure of your file.

We are currently considering introducing two different views of your code. One might be called the Marker Bar view. It would be meant to help you find key areas in your code, such as breakpoints, errors, bookmarks, search results, etc. A second view, called thumbnail view, might present the developer with a condensed overview of the entire document. Both features are shown in Figure 1.

 

DocumentMap

Figure One: The proposed Marker Bar View is shown on he left, and the proposed Thumbnail View is shown on the right.

Please remember that Future Focus is designed to give you an overview of proposed features about which we would like to get feedback. We are not promising that any of these features will be part of the product, and these features may change substantially if they are released. The goal of this project is to give you a chance to comment on proposed features, letting us know if you think they are worthwhile, and whether you think our proposal is well designed. In this particular project, we are not looking for overall comments on the future of Visual Studio or the C# language, but rather comments on the Document Map Margin feature.

Please comment in the Future Focus release area outlined below in the resources section, rather than appending comments to this post. Thank you for your support and your interest in our .NET languages.

Resources

kick it on DotNetKicks.com

Comments (34)

  1. You’ve been kicked (a good thing) – Trackback from DotNetKicks.com

  2. munkeycat says:

    Thumbnail view would be really nice. Key would be how resource hungry the implementation is. Why not display it as popup so it doesnt take up real estate as well?

  3. Dave Haynes says:

    I’ve used RockScroll in Visual Studio in the past, and while I liked it, I eventually uninstalled it because it had problems with collapsed Regions. I think a feature like this would be useful in Internet Explorer and Word.

  4. boomhauer says:

    bout time. visualization and tracking tools are the last frontier for efficient coding.

    such as, how bout a preview for the content of a method… or a way to backtrack to your previous point after drilling into a method to view its code. lots of room for improvements in these areas.

  5. Please just allow outlining on {} like c++.  It helps manage large for, if, and while statements.

  6. Charlie, I hope you guys make the gutter bar on the right extensible, so that plugin makers, like JetBrains (makers of ReSharper) who were early adopters of this UI paradigm do not get left out in the cold.

  7. Steve says:

    The first thing I install after VStudio is RockScroll – I can’t work without it any more.  Putting it directly into the IDE and improving its ability to work with regions would make me a very, very happy person

  8. arghhh says:

    Much more useful navigation feature would be to fix the existing navigation features like going forward/backward using mouse thumb buttons and media keys in the keyboard.

    Currently it ranges from broken to random, try using them in a c# project (ide config to C# settings), then configure the IDE to use c++ settings and use them in c++ project. And even when they appear to be working sometimes, 10% of the time they don’t work properly – clicking on the back navigation in IDE does sometimes different things and sometimes not. For best chance of noticing the random workings, use the Find feature along with other ways of navigating the code, then trying to use back/forward mouse buttons often between there.

  9. object says:

    i want to use this opportunity to suggest a different productivity enhancement in vs next. we might have an automatic error-fix like it is implemented in eclipse. it could add missing ; or add casts etc. this can be extended to runtime errors as well e.g. adding checks for null on a nullrefexception. the key for autofixes would be that they can be applied quickly. otherwise typing them manually would be quicker.

  10. ahlvienna says:

    This is simply great – I know that feature from Eclipse – but the document overvoiew is a great additional idea. A a programmer I know where my code parts are – to scroll very fast there is a very good feature!!!

  11. configurator says:

    I completely agree. Five or six years ago, I used some IDE which had that thumbnails view, and it really made life super-easy. It’s one of the features I actually miss in visual studio.

  12. xowl says:

    Marker View looks a lot to me like the (rather confusing) compressed view in WinDiff. Thumbnail View looks like exactly what I’d want, as would hopefully include the highlights for breakpoints and bookmarks as well the coloring of #ifdef’d out text. I wouldn’t want it to highlight syntax, although comments and string might be a help.

    I would be worried about performance hit on updating Thumbnail View (the VS editor isn’t exactly the fastest out there as it is). Maybe a hotkey to pop it up?

    I would love to have another option: Thumbnail View with Collapse to Definitions always on, but listing breakpoints and bookmarks within the functions:

    funcHeader(…) {}

    funcHeader(…) {}

    funcHeader(…)

    {

    Bookmark Line

    Bookmark Line

    }

    Maybe with a line or two of context, but I’d be happy without.

    That’s icing, though. Thumbnail View is great. For Marker View, I just hit the button to cycle through bookmarks or use the breakpoint or error windows.

    I am curious, if the Thumbnail View were to be sizeable, would the font resize or would it just show more/less horizontally? How is the size chosen, and is it relative to a fixed width or to the maximum or average width of the content (I’d say the maximum width not over a standard deviation of the average maximum, with 80 cols as a minimum, but who knows?), etc.

    So to sum-up:

    – Marker Bar View just kind of seems silly to me

    – Thumbnail View looks great

    – I’m worried about Thumbnail View performance, especially on large changes like running macros, reformatting documents, some refactoring, etc.

    – I really, really want Thumbnail View to respect my view preference for whether to use an indicator margin (as an old VC6 user, I hate the indicator margin and still use F2 to cycle bookmarks)

    – I don’t want to see the Thumbnail View bar get feature creep and gain selection, add/remove bookmarks, highlight current cursor line, etc.

    – It would be useful to show the selection in the Thumbnail View, though, should it extend off the screen

    – I might (might) like a hover-to-magnify option to help see where a region of text is, but that’s definitely icing.

    – I can’t decide if Thumbnail View should respect the current outlining state or be always expended (or have a separate outlining state whereby anything not on-screen is collapsed with hover-to-expand)

    And no matter what, this is great and it’s the kind of thinking we need to actually solve the invisible problems we face every day. I have inherited too many 2,000+ line files with messes of unrelated functions (and too much risk to do the much-needed refactoring); I know that the visual shape of the code is the fastest way I get around a large file.

  13. Jamie Mack says:

    Thumbnail View will be brillient for navigation.  Marker Bar will be helpful but reminds a bit of beyond compare, one possible enhancment when you click on the marker it shows a ballon with a snippet of code where the marker is set, saving you a heap of time scrolling to it.

    Nice Work

  14. Kostas says:

    Anything that will standardize RockScroll has to be a great thing!

  15. Eirik M says:

    Wouldn’t it be better to teach people e.g. refactoring? I shiver when I hear "work on huge source files" or "manage large for, if, and while statements". Guys, before you ask for tool support to help you manage your own mess and thereby let you go on with your erroneous ways, please sit down and learn proper software engineering/development principles.

  16. I have to agree with Eirik M–and it’s hard to believe it took over two dozen comments before someone said this.

    Making tools to manage large source files misses the point: WHY do such files exist in the first place, and what can be done to make them smaller.  That should be the focus, not providing tools to make it easier to continue bad habits.

  17. Paul D. Murphy says:

    This is a good idea but you are building it on top of a broken paradigm. Before you guys do anything like this you need to ‘fix’ designers.

    *** Designers should be able to ‘spawn’ dynamic tool windows to address views ***

    The design surface in the class designer is a perfect example. Outside of platform constraints there is no reason to have to dynamic ‘properties’ designer on the bottom of the main visual designer. This ‘properties’ designer should be a tool window and end users should be able to position them in the tabs and docks accordingly.

    Adding a thumbnail view on the designer is great. Mashing onto the right hand side of my code editor… not so great.

    Fix the real problem. Then build great tools on top of it.

  18. Paul D. Murphy says:

    I couldn’t disagree more with this "before you ask for tool support to help you manage your own mess and thereby let you go on with your erroneous ways, please sit down and learn proper software engineering/development principles." more.

    Out here in the real world breaking down that 10k line file a customer gives you on the grounds of "proper" could cost you a contract.

    Maybe in your tiny version of reality "proper" trumps and customers will pay for hours and hours of cleaning up someone elses mess, but in my tiny version of reality customers are fine with band-aids, hacks and just making sure it works. Telling them you want to bill them 10 hours for "refactoring" a code file doesn’t exactly cut mustard.

    Then you have the scenario where other hands are in the project and refactoring that 10k line file means a massive code churn that affects a large team.

    I would encourage Microsoft to extend tool support on all fronts because out here in the real world we see all fronts, and most of those fronts are miles away from ‘proper’.

  19. arnshea says:

    I like marker bar view.  Strikes me as sitting somewhere between the object browser and class view.

    Marker bar view could be useful in cases where you’ve inherited a large source file and are manually tracing through certain code paths to figure out how the object works.  Right now I use a combination of "Go To definition" (F12), "return to last position" (ctrl+_) and low tech pencil/paper but might rely more on bookmarks if I had a more visual way to navigate them (e.g., "I just came from the bookmark a few inches above this one, so I’ll click on it to jump back).

    I’m always on the lookout for ways to replace paper with electrons so a helpful addition would be annotated bookmarks.  Marker bar view could use a tooltip to display the annotation when the cursor is hovering over the bookmark.  Annotation sounds too technical; I could even go for displaying the nearest comment when hovering over the bookmark.

    Not sure about thumbnail view.  It’s a bit wide – for me that means it’ll compete with solution explorer/class view/resource view/macro explorer for space.  I’m also not sure how valuable thumbnails of source code are – are they large enough to be legible?

    Thumbnail view could be useful for fixing compilation errors and warnings.  It’s wide enough to provide a little context and would be a convenient way to quickly fix errors arising from a single source (e.g., I add a parameter to a method, this breaks everything that’s calling that method).  Right now this can be done from task list but it’s horizontally oriented – a vertically oriented way to do this might get more usage.

    Would be nice to have these integrated with keyboard shortcuts for traversing each of the elements called out by the various bars.

  20. Chris P says:

    Something I would find much more helpful is if the line currently containing the caret could optionally have a different background colour to the normal line backgroud colour. Carets are not very wide and sometimes difficult to see – especially when double clicking a result line in "Find All References" – the caret can move its position and be hard to find. Not very hard, but harder than if the current line was a different shade.

  21. Chris P says:

    Something I would find much more helpful is if the line currently containing the caret could optionally have a different background colour to the normal line backgroud colour. Carets are not very wide and sometimes difficult to see – especially when double clicking a result line in "Find All References" – the caret can move its position and be hard to find. Not very hard, but harder than if the current line was a different shade.

  22. Mo'ath Abu Hafeeza says:

    The C Sharp Programming Language

    it’s Powerfull And Easy

    Thanks

  23. ccalvert says:

    Thank you all for replying. I want to remind you that it would be best if you commented on this on Code Gallery. See the post above for the link. We just want to make sure the IDE team members see your comments. I do, however, read carefully what you write here, and will try to find time to make some kind of thoughtful response in the next few days.

    – Charlie

  24. EricTN says:

    Resharper has a marker view like that.  Could you please work with Jet Brains so that their tool would play nice with the VS version.  I actually think I would get more out of the VS Marker View than I get out of the Jet Brains similar tool, but it would be nice if they both shared that space in an elegant fashion.  It would be helpful if with a right-click context menu I could swap between them – I definitely wouldn’t want to look at both at the same time!

    Also I can think of something more fundamental to aid me in navigating a long page — PLEASE allow Regions in HTML Code View like you have with C# or VB.NET code view.  The only thing I’ve got right now (at least it’s something) is I can collapse all tags in HTML, but that can be a pain.  Also, I think you should promote Outline Collapse To Definitions as a default button on the toolbar – I think the notion of using Regions and initially viewing code collapsed should be promoted/encouraged instead of buried with other Outline actions that after years of using Visual Studio I still can’t seem to find use for.

  25. EricTN says:

    Also please let us have Regions in web.config.

  26. Jan Jansen says:

    I will probably not use that feature because

    The only thing I need is two keys to jump to the next/previous feature (method / variable / constant). VB6 had this feature (in 1998?).

    I use regions to group features, typically:

    #region Construction

    #region Properties

    #region Commands

    #region Implementation

    #region Implementation data

    With CTRL+M M you can expand / collapse the regions, this provides reasonably quick navigation.

    Best regards, Jan Jansen

  27. Ted says:

    Three needed requests:

    1. SQL refactoring tools – please add even basic SQL refactoring tools (rename local variable, rename parameter, etc.).  

    2. Refactoring tools for C++/C code (somehow missing from VS 2008 for mixed C++ / C projects)

    3. I need to, for vision reasons, work with a black background in Visual Studio.  Can you make all of the normal windows (code, properties, class browser, project explorer, etc.,) allow for color changes?  This is for lime green text on a black background.  Designer view, object diagrams, and other graphical windows do not need this color scheme (it would be nice but not needed as I do not do much visual design).

    5. A higher level nice to have would be a way to map out the source code function by function or class by class so that we can see the dependency amongst different source files.  We would use this to reorganize functions into source files to minimize the number of times code in one file refers to another file (this is a precursor to making everything static/private that can possibly made private/static).  This is a big need for us because we have inherited ~500,000 lines of vb.net code written in a classic ASP style (long functions, everthing declared at the head of the function, no attempt at reduceing the amount inter-file code relationships, duplicate code, etc).

    6. Profiler put back into VS professional edition for C#, VB.NET, and C++ just like it was with VS 6.0.

  28. Clive Chinery says:

    This looks very much like one of the Resharper items. If this new feature is developed in conjunction with JetBrains, it is to be welcomed.

    It could show the positions of errors in the code, FXCOP gripes and StyleCop moans.

  29. verisimilidude says:

    This is similar to my Master of Software Engineering thesis work – done in and for Java however.  Additional things I found useful were to be able to highlight all calls into a function (I opened tabs in the background for calls to public functions), all code called by a specific line or function (recursive descent or just one level), all locations where a class variable was used, or just locations where it was assigned, and ‘bad smells’ like blocks of repeated code and excessive indentation. Clicking on a highlighted line (usually unreadable in the miniature view) would bring up a pinnable window allowing quick side-by-side comparison of different file sections. I also would gradiant color functions by various software engineering parameters, number of calls in, number out, number of variables declared or class variables used, and McCabe Complexity. Something I never got done but wanted was the ability to edit blocks of code in the miniature view – rearrange functions, refactor a group of functions into a new object, etc. I’d love to see this move from an unreleased Eclipse plugin to being a slick, supported part of VS.

  30. Like few others here I would ask for other functionality but this.

    We should try to help people write better and more maintainable code and not give them tools to write bulkier and harder to maintain code.

    Working on large files is a classic smell of bad quality code. People two write 20 page if statements or 100 case switch statements.

    Please spend time to write better refactoring tools and make the IDE faster.

    The more tools you give to write messier code the more messier the code will be.

  31. Jeff Pang says:

    It will be great if images and diagrams could be imported as part of a comment to illustrate how a particular function or code work (which could auto hide or collapsed like a #region).

    This can help navigation of the code rather than have to decipher the loops and hoops.

  32. jan smit says:

    In the old skool days of the C64 (Commodore 64 that is), there was a text editor that started to scroll when the cursor was a few characters from the border instead of when the cursor was at the border. This I really liked because now I often scroll too much and then back so I can see the context.

  33. Richard Hein says:

    boomhauer said:

    "how bout a preview for the content of a method… or a way to backtrack to your previous point after drilling into a method to view its code"

    You can do both of those things already in VS2005-2008….

    Code Definition Window shows you a preview of the content of a method, and the code navigation buttons move you forward/backward through your navigation operations.  

  34. Rob Gersna says:

    I love Rockscroll and would welcome the thumbnail view. I work with an aging codebase flush with large files and several different code formatting strategies, regioning patterns, or lack thereof. Refactoring is a series of small changes that will take a few years to fully clean up the codebase. In the meanwhile, I’ll be RockScrolling!