T O P I C R E V I E W |
Inquisitor |
Posted - Oct 17 2007 : 06:59:48 AM I think it would be a great if VAX had a feature where it would see camel-cased or an underscore as a separator (i.e. a space). That way it would be much easier using ctrl+arrow to replace and rename single words in an identifier.
Example #1: Given the identifier FooBarUnderscoreHandler I would like to make a FooBarSpaceHandler. With the cursor at the start of the identifier and the feature enabled I would just ctrl+rightarrow twice, hold shift and ctrl+rightarrow once and type "Space" to end up with "FooBarSpaceHandler". Very easy and quick because VAX treats a change in casing within a word as a space if this feature is enabled.
Example #2: Given the eventhandler textbox1_KeyDown I would like to make a general handler called TextBox_KeyDown instead. With the cursor at the start of the word it's just hold shift, hit ctrl+rightarrow once and type "TextBox". Easy and quick because VAX treats an underscore within a word as a space if this feature is enabled.
I have not been able to find this suggested elsewhere, if it has then please just ignore this suggestion.
I have been using VA since 2001 with C++, but now mainly use it coding C# and I wouldn't be without it!
|
18 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Apr 26 2011 : 5:06:54 PM We like to be cautious when changing the default behaviour. Personally I use Ctrl+Arrow all the time to move through both lines of code and text, and if it suddenly slowed down, which this change will do, then I would be unhappy, since it would mean I have to use more key presses to achieve the same result. But I am not a representative VA user
rryk's comments about a keyboard mapping dialog, this already exists:
The IDE options dialog -> Keyboard settings
We are looking to add a dialog to VA that is shown just once, to list new keyboard shortcuts that VA could map for you, if you accept them, but it is not designed to handle the full complexity of managing all of your keyboard mappings.
The macro icon, if you mean the one in the Windows taskbar, try right clicking on the clock and selecting "Customize Notifications..." or "Customize Notification Icons..." depending on your OS. Here you should be able to tell Windows to always hide the Visual Studio macro icon. |
ricardog |
Posted - Apr 26 2011 : 2:55:34 PM I also think replacing ctrl+arrows would be better, since it would allow the new behavior on related features such as ctrl+delete, ctrl+shift+arrow, etc. The default behavior is not being lost, just incremented, so I don't think it will have a negative impact even if it's enabled by default. |
Inquisitor |
Posted - Apr 26 2011 : 2:04:33 PM quote: I am not concerned about adding the feature, I am concerned about changing the default behaviour of "standard" keyboard shortcuts in the IDE. Working in support has taught me that changing how the IDE works without proper warning tends to upset people, since suddenly it is no longer doing what they expect.
I'm extremely confident that the relatively few people who use ctrl+arrows to navigate their source would be more than thankful for this feature! They would never complain for sure. |
rryk |
Posted - Apr 26 2011 : 09:24:37 AM I agree that remapping default behavior of Ctrl+Left and Ctrl+Right can cause too many complaints, but not to make it optional and disabled by default? Even better is to have a shortcut editor, where one would be able to select their own shortcuts for that, e.g. Ctrl+Alt+Left, Ctrl+Alt+Right.
As for the macros, I find them useful (thanks for the link), but it's annoying to see macro icon appearing and disappearing in the status bar every time I use it (do not confuse with balloon, that I have disabled already). |
feline |
Posted - Apr 08 2011 : 3:00:31 PM You can remap Ctrl+Left arrow and Ctrl+Right arrow to the macro commands in the IDE options dialog -> Keyboard settings.
You can also remap Shift+Ctrl+Left arrow and Shift+Ctrl+Right arrow just as easily, so you will get the new behaviour instead. Based on some initial testing this macro just "extends" the normal motion exactly as you are asking for.
The macro commands to map these key bindings to are "MoveRightCamelCaseWord", "MoveLeftCamelCaseWord", "ExtendSelectionRightCamelCaseWord" and "ExtendSelectionLeftCamelCaseWord"
I am not concerned about adding the feature, I am concerned about changing the default behaviour of "standard" keyboard shortcuts in the IDE. Working in support has taught me that changing how the IDE works without proper warning tends to upset people, since suddenly it is no longer doing what they expect.
As for working with these movement commands, I have started adding this macro and extra (different) keybindings to my development machines, but personally I still find this movement scheme "slow" and "unreliable". I miss the Vim keyboard movement system, but have never been able to use one of the Vim plugin's, since the way I work in Vim and Visual Studio is so different trying to merge the two just confuses me to much. |
Inquisitor |
Posted - Apr 08 2011 : 1:02:47 PM Sure, but that's not what we want. It must be work with ctrl, shift and arrow - just like you'd expect if there was a space instead of a capital letter in the middle of the word.
feline, I just read up on this thread and you have a lot of concerns about adding this feature. Why?
I think it's because you don't understand it. You don't realize how intuitive and brilliant it is, because you have never tried it. I think you should download the free Resharper trial and try the CamelHumps feature (http://www.jetbrains.com/resharper/webhelp/Navigation_and_Search__CamelHumps.html) for a few minutes and see exactly how 'dangerous' it is to alter the behavior of ctrl+arrow a little. :) |
feline |
Posted - Apr 07 2011 : 5:40:44 PM Unfortunately no progress to report on this, but this is something that can be done via an IDE macro. I started writing a macro to do this, when I found someone had already created one:
http://visualstudiomacros.blogspot.com/2008/03/getting-ctrl-right-arrow-to-respect.html
you just need to map the macro commands to some keyboard shortcuts. This may not be as fast as having VA do this, but hopefully this is a useful solution for now. |
ricardog |
Posted - Apr 07 2011 : 01:41:24 AM Is this being considered yet? Both ReSharper Pro and CodeRush Xpress support this feature (see http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/navigation.xml). I think it's very useful but I don't want to install those add-ons just to have such a simple feature. |
feline |
Posted - Oct 25 2007 : 08:38:07 AM I have already put in a feature request, case=9408
It is simply that I have concerns over changing how the current Ctrl+Left / Right arrow behaviour works. |
znakeeye |
Posted - Oct 25 2007 : 08:17:19 AM I have to admit that this would indeed be useful. I mean, how often don't you want to remove 'XXXX' from 'GetXXXX' and type in something else?
I think you should reconsider this. |
feline |
Posted - Oct 20 2007 : 2:04:14 PM We are trying to avoid adding extra options. Plus as soon as we allow you to modify how CTRL-SPACE works, how long before someone complains we have not modified CTRL-SPACE in the IDE find dialog? Or some terribly obscure dialog in the middle of the IDE options.
I am slightly concerned about this, while at the same time I do see the appeal. |
sl@sh |
Posted - Oct 19 2007 : 09:00:37 AM I wouldn't use the term 'logical' - I think 'natural' is what you meant to say. And yes, I agree that it would be a 'natural' way of reading and modifying code.
However, Ctrl-Arrowkey is implemented in many text based applications to only recognise whitespace or punctuation as word delimiters, so enabling this option by default isn't that good an idea. It should be provided as an additional option. |
Inquisitor |
Posted - Oct 18 2007 : 08:59:50 AM quote: Originally posted by feline
I see the appeal of Ctrl+arrow doing this, but on a long line I find Ctrl+arrow takes to long to get me where I want to be as it is, tripling the number of key presses to get to my desired destination does not sound good
Yup, that's why it would be an option that can be disabled if you don't like it. ... But I bet that a lot of people would appreciate it because it is after all the logical* behaviour given the context - and it's apparently already implemented in another well-known IDE.
*) By logical is understood the way we read the text when we code. |
feline |
Posted - Oct 18 2007 : 08:44:10 AM I see the appeal of Ctrl+arrow doing this, but on a long line I find Ctrl+arrow takes to long to get me where I want to be as it is, tripling the number of key presses to get to my desired destination does not sound good
You could probably implement this feature fairly easily as an IDE macro, but from my limited experience with them the performance would be terrible. |
Inquisitor |
Posted - Oct 18 2007 : 08:26:16 AM According to the logic I described in my previous posts, it would be treated as two separate words, i.e. "my" and "MFCDialogue".
btw, I mentioned my feature suggestion to a friend who is a Java developer. He said that IntelliJ already had that feature! I don't if it is exactly as I figured it could be implemented, but just for the record it has been done before. |
sl@sh |
Posted - Oct 18 2007 : 08:04:48 AM What about symbols with multiple consecutive caps, e. g. "myMFCDialogue" ? |
Inquisitor |
Posted - Oct 17 2007 : 09:50:29 AM quote: Originally posted by feline
It is an interesting idea, but it would probably need a different keyboard shortcut. I am so used to using CTRL + left and right arrow to move through text that any change to how this works would be quite confusing, and irritating.
I also use the ctrl+arrow (and hold shift to select) all day, that's why I thought it would be a real help. I have long identifier names in C# (FXCop restriction) and it would be cool if VAX understood the identifier as I do: As separate words. Though when the feature is enabled, the separator not just a space, but also a change in casing or an underscore in the middle of the word.
Having the feature as a special shortcut kind of defies the purpose IMHO.
quote: Originally posted by feline I have put in a feature request to see what our developers make of this.:
case=9408
Nice. Thank you.
quote: Originally posted by feline Personally I can certainly see the appeal, but also a couple of possible problems, the first being I want to hold down Shift to select a part of a work to delete / overtype.
Ctrl, shift and arrow keys functions just as before - there are just more "stops" on the way, since a word like e.g. "textBox" would be seen as two separate words. |
feline |
Posted - Oct 17 2007 : 09:11:24 AM It is an interesting idea, but it would probably need a different keyboard shortcut. I am so used to using CTRL + left and right arrow to move through text that any change to how this works would be quite confusing, and irritating.
I have put in a feature request to see what our developers make of this.:
case=9408
Personally I can certainly see the appeal, but also a couple of possible problems, the first being I want to hold down Shift to select a part of a work to delete / overtype. |