Rich Rodecker’s blog on flash, flex, actionscript, javascript, and php, with a dash of randomness
Auto-create getters/setters in TextMate
Since I'm digging into components more I have been writing a lot more getters/setters than I used to, which I don't like, because they are just boring. Luckily, I found a TextMate command by Jason Froderman that will automatically create getter/setter pairs from a class property you have selected. Yeah!
note: it wont work if you already have a value assigned to the property:
Actionscript:
-
private var a:Number
works
Actionscript:
-
private var a:Number =10
no workie.
| Print article | This entry was posted by rich on March 14, 2006 at 2:34 pm, and is filed under flash. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 4 years ago
You can also use a snippet, a little simpler. I set my tab trigger to "getset"
// @property ${2:Description}
private var \$${1:name}:${4:Type};
/////////////////////////////////////
/*
// @method get ${1:name}
//
// @description ${2:Description}
// @return ${4:Void}
*/
function get ${1:name} ():${4:Type} {
return \$${1:name};
}
/////////////////////////////////////
/*
// @method set ${1:name}
//
// @description ${2:Description}
// @param p_${1:name}:${4:Type} Description
// @return ${4:Type}
*/
function set ${1:name} (p_${1:name}:${4:Type}):${4:Type} {
\$${1:name} = p_${1:name};
${5:statement;}
}
about 4 years ago
whoa!! that is awesome! thats the first time i ever tried using a snippet. That's friggin sweet how you can put the tab stops in there to tab around to the necessary points after you insert the getter/setters. thanks for that!