intention actions with placeholder
Hi everybody!
I have a doubt.
I have in my custom language an element wich has parameters like this Person(name="Loren", surname="Ipsum").
When I'm writing it, I wish that the IDE assist me putting all the parameter names available and the placeholders for the values. Like this: Person(name=[], surname=[]), where the squares are the placeholder.
I guess that these could be with an intention action, but I don't know how to create it with place holder.
Maybe It could be with live templates, but guess they are size fixed, so I cannot put variable size of placeholders.
Any idea??
Thanks!
Please sign in to leave a comment.
I probably don't really understand what you mean by
but the rest smells like LiveTemplates would be a good idea. Remember that you even can give initial values to place holders. In my language, I have for instance a live template "nst" which is defined like this
Once it is expanded it looks like
where all 3 positions func, expr, and n are placeholders and can be visited by pressing tab.
Cheers
Patrick
I've never used live templates, but my problem is that I want just a template to init any object. That is:
Person A(name = "Loren", surname = "Impsum")
Person B(name = "Loren", surname = "Impsum", birthday="1950-10-10")
Dog Z(breed = "dalmata", name = "Pongo")
So, I can parametrize much type of objects, and each object has diferent parameters.
I cannot create a xml template for each one because I dont know these functions in advance. Something cool could be create the template "on-live", on the moment of the call.
I hope have explained better.
Thanks!
I'm also looking for a way to add those "red rectangle" placeholders, and came across two solutions:
Build a live template dynamically, then invoke it, as described here: https://devnet.jetbrains.com/message/4909638#4909638
Or add placeholders by yourself in the editor:
Which is what live templates do under the hood.