Sublime Forum

Generate Getters/Setters (like in Eclipse)

#1

Hi,

I’m already using a plugin to generate one serie of getter/setter (or setter/getter alone).
But (a very long long long time ago) I used to work in Eclipse, and it has a nifty feature where u could ask to generate getter and setters for the datamembers in your PHP class. (Or Java,…)

Does anyone has a plugin like this? I’m using this tool now : shuchow.com/gettersetter.html
But my (Eclipse/Aptana) colleagues are laughing with me :blush:

Many thanks!

0 Likes

#2

I’ve created a small generator for PHP files.
It’s just a 10min version and I don’t know python at all :open_mouth:

Some issues:

  • Doesn’t check indention
  • Just adds it to the end of the file (not within the class)

Suggestions and fixes are welcome!

Edit:

Gist Url: gist.github.com/3635821

0 Likes

#3

You could also create a snippet here’s one I use for C++:

<snippet> <content><![CDATA[ ${1:returnType} Get${2:Something}() const { return m${2:VariableName}; } void Set${2:Something}(${1:returnType} arg) { m${2:VariableName} = arg; } ]]></content> <tabTrigger>getset</tabTrigger> <scope>source.c++</scope> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <!-- <tabTrigger>hello</tabTrigger> --> <!-- Optional: Set a scope to limit where the snippet will trigger --> <!-- <scope>source.python</scope> --> </snippet>

0 Likes

#4

Have you tried github.com/francodacosta/sublim … rs-setters ?

0 Likes