Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Joining multiple code lines together
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rpalma
Junior Member

Belgium
23 Posts

Posted - Oct 31 2017 :  07:23:18 AM  Show Profile  Reply with Quote
A new coding assistance feature to join multiple adjacent lines of code together would be helpful.
Consider the following snippet:

int GetValue() const
{
  return m_nValue;
}

After selecting those four lines in the editor and pressing a 'join lines' keyboard shortcut, the content of those lines will be collapsed, with unnecessary white space removed:

int GetValue() const {return m_nValue;}

Also, it would be nice to be able to join the 'current' line with the next one via a keyboard shortcut, without having to select those lines first.

I know there are VS extensions that can do this, but it would be nice if my favorite extension would support this feature.


feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Oct 31 2017 :  08:50:56 AM  Show Profile  Reply with Quote
A fairly simple regular expression search and replace will do this for you. To automate this, and map it to a keyboard shortcut, you could write an IDE macro and map the macro to a keyboard shortcut. This would require an earlier IDE which still has macros built in, or a macro extension, but doing it this way would give you full control over the formatting via the search and replace.

In fact, this sample macro, that does a search and replace across selected lines of text, could easily be changed to do exactly this:

https://support.wholetomato.com/default.asp?W445

zen is the art of being at one with the two'ness

Edited by - feline on Oct 31 2017 08:52:38 AM
Go to Top of Page

rpalma
Junior Member

Belgium
23 Posts

Posted - Oct 31 2017 :  09:49:49 AM  Show Profile  Reply with Quote
Unfortunately VBA macros have been removed since VS 2012, if I am right.
As this is something that I need to do quite frequently, I don't wan't to repeat all the necessary steps to accomplish this via regex find/replace.
So that brings me back to extensions, and my question to include this in VA, as I want to limit the number of installed extensions.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Oct 31 2017 :  10:03:28 AM  Show Profile  Reply with Quote
Unfortunately this is really getting into code formatting, which is something we are not looking to add to VA at this point in time. The reason is simply that everyone wants something different, so you end up having to have a great many options to specify all of the different formatting rules people want.

I know VBA macros have been removed in recent versions of the IDE, but there are a couple of extensions that can add this ability back in again. But yes, this does leave you needing to use another extension, but hopefully one designed to do this specific job well.

zen is the art of being at one with the two'ness
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 31 2017 :  11:41:25 AM  Show Profile  Reply with Quote
I like the idea and I have put in a feature request for this:

case=112075

I would imagine this as a refactoring command.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000