Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my project, I have many serialization classes and, to make the classes more readable, I'm standardizing them, with an argument which has the same name of the $class$, that is $argName$:

@immutable
class $class$_Serialize extends Serialize<$class$> {
  final $class$ $argName$;

  $class$_Serialize(this.$argName$);

  @override
  Map<String, Object> run() => $serialize$
}

In the Live Template above, the annoyance is that I have to retype $argName$ instead of the template simply decapitalizing $class$. How would I tie $argName$ to the decapitalization of $class$ in IntelliJ?

I've already tried to mess around with editing the variables and adding the decaptialize() function in the expression column, but so far haven't had much success. It was something like this:

Attempt at using decapitalize()

question from:https://stackoverflow.com/questions/65852123/how-to-decapitalize-an-argument-in-a-live-template-in-intellij

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
718 views
Welcome To Ask or Share your Answers For Others

1 Answer

You are using the wrong syntax for the decapitalize function. It should look like this:

decapitalize(class)

Note that there are no $ signs around the class in the function argument.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...