开发者

Copy/Cut collapsed code and have it collapsed when pasted

When I copy or cut collapsed code and paste it somewhere else, the code gets expanded. Is there any way to make Visual Studio to retain the collapse/expand state when copy/cu开发者_Go百科t/pasted?

I'm hoping that I can rearrange methods order quickly by cutting and pasting while all the implementaion details are nicely collapsed.

I'm working on VS2008 (C#) right now, but any tip on VS2010 is also appreciated.


I don't know of doing what you are asking, but if you currently use Resharper (or are interested in trialing or buying it) then it includes a File Structure window in which you can easily change the order of class members, classes themselves and regions simply by dragging them around.

In addition it adds keyboard shortcuts for moving whole methods up and down within a type.

Beyond these simple rearrangement functions, it also has a wealth of refactorings for moving methods within the type hierachy, extracting interfaces, &c.


How about Creating a macro for pasting+collapsing ?


I experience the same disturbing behavior. I collapse manually methods, since it is more readable and accessible when you have thousands of lines in one class. After pasting an import line , all the code is expanded. And it is an overkill to collapse them again. It is very interesting that it only happens when I work with JS code. For example, When working with PYTHON, this problematic behavior does not seem to happen any more.

CMD + K + 2

is my makeshift to this problem , since I usually collapse only methods which are under class making them level 2.

But you loose your custom collapse structure and I think this is a bug since this behavior does not happen in Python code but happens in JS Code.

(Note:Don't tested in other languages yet.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜