T O P I C R E V I E W |
Dusan |
Posted - Nov 08 2013 : 04:53:22 AM As additon to $end$ would be fine to have a $next$ which would be used in similar cases:
SizeOf for $end$ (shortcut "so"): sizeof($end$)
SizeOf for $next$ (shortcut "so"): sizeof($next$)
Both could be defined in list, but when user would type "so", VA would check, if there any identifier follows - currently VAX provides Rename refactoring, so if I type "so" before identifier, VAX asks to rename references of identifier to "so"+identifier. With $next$ VAX should check first, if there any snippet containing $next$ with shortcut "so" exists, and if exists, then would provide both, snippet to apply $next$ and also refactoring to rename. If does not exist such snippet, VAX asks only about Refactoring as it is now...
To describe, let's say I have following code.
MyClass * mPtr = mCPtr;
and following snippet: $next$ ? $next$ : new $next_type$($end$);
I will place caret in front of mCPtr (consider | as caret) as: |mCPtr and type snippet shortcut, lets say "iff" result would be: MyClass * mPtr = mCPtr ? mCPtr : new MyClass(|);
How about it?
|
2 L A T E S T R E P L I E S (Newest First) |
Dusan |
Posted - Nov 26 2013 : 05:55:24 AM quote: Just selecting the code and using $selected$ or $clipboard$ in the snippet body will achieve the same result
You are right, also if I type it completely, I'll get the same result. |
feline |
Posted - Nov 25 2013 : 7:26:13 PM I think I understand the idea, but I have had to re-read your post about 7 times to work this out. It is an interesting shortcut, but I am not sure its really going to get much use, and its going to be tricky to explain.
Just selecting the code and using $selected$ or $clipboard$ in the snippet body will achieve the same result, and you can do this now. If you press the VA Snippet toolbar button while you have selected code, only snippets that use $selected$ will be shown, so you will only see the relevant ones. |
|
|