SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Siegfried Pammer

September 2011 - Posts

  • Tip No. 1: Ctrl+W

    Even as core developers of SharpDevelop we sometimes stumble across features in our own product, we did not know about before. Hence we decided to create a SharpDevelop Tips&Tricks section on our blog(s), to let you know all the cool features you can use to speed up your work. Today I want to start with something simple.

    Problem

    It often happens that you want to select of the code, whole methods or statements, or even (parts of) expressions. Of course you can do that by using the mouse or use Shift + the arrow keys, but it feels very clumsy and is inaccurate and error-prone.

    Solution


    To avoid this a small hidden feature comes in very handy: Control + W. It is simple to use: Place the caret (the "keyboard cursor") somewhere inside of a piece of code you want to select.

    Then hit Ctrl+W and the innermost expression, statement or member will be selected. Hit Ctrl+W again to extend the selection. You can repeat this as many times as you want; you will end up having selected the whole file.



    Remarks

    Imagine how this feature can be used in conjunction with other features like surround with (Ctrl+J) or extract method. In the future there could be a Introduce variable/constant refactoring, which extracts an expression into a variable/constant initializer.

    Quick note: currently it is not possible to undo or shrink the selection. Would you like to have something like that too? If so, which keyboard shortcut would you choose to make it easy to use?

    Update: Shrink selection was added as Ctrl+Shift+W in SharpDevelop 4.2 alpha builds. Thank you for your feedback.

    Version Information

    This feature is available in SharpDevelop 4.0 and newer.

Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.