T O P I C R E V I E W |
plabrie |
Posted - Nov 14 2009 : 02:04:18 AM Snippet are great, but it would be so much more powerful if the refactor reserved keyword would be available to snippet. I thought they were at first and I am not sure the work involve to do this, but refactor keyword permit to get the type of the current variable for example, etc.
Like these keyword: $SymbolName$ Name of member field $SymbolType$ Type of member field $GeneratedPropertyName$ Generated name of accessor method
It's a bit like our own custom refactor method. I saw the suggestion somewhere. If at least it's available in the snippet, it could be a nice first pass. |
4 L A T E S T R E P L I E S (Newest First) |
plabrie |
Posted - Nov 17 2009 : 8:22:36 PM I didn't see classname, thank you, might be useful. But no, i am not using standard lib and I don't really want to add a snippet per type of container also like a map, vector, list, etc. |
feline |
Posted - Nov 17 2009 : 1:08:27 PM This is exactly why doing this is difficult, since you are asking for information about a specific (local) variable. We are considering adding a VA Snippet keyword to enter the type of the selected symbol:
case=24243
to try and help with exactly this problem. For now, if you are working on a standard container type you could have some snippets where the type is hard coded.
Alternatively you can use both $clipboard$ and $selected$ in the same snippet, so one can give you the type and one can give you the variable name.
You can also get the current class via $ClassName$, see the "Symbol Context" keywords in the list of reserved keywords on this page:
http://www.wholetomato.com/products/features/vasnippets.asp |
plabrie |
Posted - Nov 16 2009 : 11:48:20 PM I was trying to do an automated creation of loop for with an iterator. By click on the "it" declaration, it would take the type declaration of that variable and add .begin() and .end() where it's needed. But i can't get the type or the current class for example to automatize my snippet. It's either selected, but that is more prompt to error (missing a letter in the selection) or ask the user for input. But writing all the std::vector<int> take a while, and i use a third party that have even more namespace. |
feline |
Posted - Nov 14 2009 : 12:41:18 PM We are considering doing something like this:
case=3204
However some of the refactoring keywords require a specific context to make sense. $GeneratedPropertyName$ for example makes no sense in most VA snippets, since it requires a specific class member variable to be "selected", to form the basis of this generated name.
What sort of things are you trying to do? |
|
|