Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Start of line code field

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
mwalshe Posted - Sep 08 2011 : 04:51:14 AM
I'd like to be able to insert snippet text at the start of the currently selected line regardless of where the cursor is located on that line. Having a code field called something like $linestart$ (similar in nature to $end$) might be a way to achieve this.

Situations where this would be useful to me would be when you have a snippet that encorporates a selection that isn't at the start of the line, for example a snippet such as:

$selected$$linestart$
////////////////////////////////////////////////////////
//
// $selected$
//
$end$

Would it be possible to add this feature into a future release?

Thanks

Max
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Sep 16 2011 : 11:44:22 AM
If we try to offer control of the caret, then how long before someone has a good argument for "up 2 lines and left 3 characters then insert some text"?

We are trying to strike a balance between quick and easy to use, and powerful enough to be useful, without duplicating the existing IDE macro system.
mwalshe Posted - Sep 16 2011 : 09:16:31 AM
Thanks for the response.

I was hoping that control of the caret would be possible as VA can set the position after inserting the snippet with $end$. I guess it's not so straight forward.
feline Posted - Sep 13 2011 : 12:05:34 PM
VA Snippets are quicker and easier to use than IDE macro's for simply inserting blocks of text at the current caret position. You can do various other things as well:

http://www.wholetomato.com/products/features/vasnippets.asp

but moving the caret then inserting text is not something VA Snippets are designed to do.

To get the 'Insert VA Snippet' menu, you can bind a keyboard shortcut to the command VAssistX.VaSnippetInsert in the IDE keyboard settings.

For the IDE macro, I would try:

IDE Tools menu -> Macros -> Record TemporaryMacro

and then type out the macro you want manually. You might want to do End before Home, to try and get a reliable behaviour for Home, if you are ever dealing with indented lines of code.
mwalshe Posted - Sep 13 2011 : 04:17:02 AM
OK I think I see what you are getting at. For shortcut induced snippets then things aren't going to work too well as the editor enters the initial key sequence into the editor document so moving to the start of the line isn't going to work particularly well.

For versions of Visual Studio prior to 2010 (which we use quite a bit) I often use the 'Insert VA Snippet' context menu (which has disappeared in VS2010) so an 'insert at start of line' would be very useful.

I've not done anything with the IDE macros as I rather like VA, however if you think it's the way to go then perhaps I should start using them more instead of the VA snippets.
feline Posted - Sep 12 2011 : 10:38:18 AM
How are you triggering this VA Snippet? If you are typing the shortcut, then having the snippet inserted where you are currently typing makes sense.

In this particular case you might be better off using an IDE macro, since you can tell the macro to move to the start of the line before inserting your chosen text. Also you can then bind a keyboard shortcut to the macro, allowing you to trigger it directly.
mwalshe Posted - Sep 12 2011 : 04:59:30 AM
Maybe I've over complicated my example.

I simply would like to able to insert the text of a snippet at the start of the current line rather than at the current cursor position.

I have an snippet called 'Class Header' which adds in my standard class separator comment into my code. To use it at the moment, I must have the cursor located in the first column of a line. Whilst moving the cursor to the correct location for the snippet isn't awkward it would be very convenient if my snippet could be instructed to insert its text at the start of the line rather than relying on me to position the cursor precisely.

I like how the $end$ tag is used to control the cursor position post snipet and so was hoping that you may be able to control the cursor position before the snippet insertion.

Best regards

Max
feline Posted - Sep 08 2011 : 1:48:53 PM
Can you post an example, to explain what you are trying to achieve? I am not sure I understand, based on this, what you are trying to do.

You might find that IDE macros help. You can do a lot with them, and there are some sample macro's in this forum section that might give you some ideas:

http://www.wholetomato.com/forum/forum.asp?FORUM_ID=35

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000