简体   繁体   English

在IntelliJ IDEA中生成Scala中的构造函数

[英]Generating constructor in Scala in IntelliJ IDEA

In Java it's possible to just select "create constructor matching super" (or something pretty similar) and it automatically creates constructor. 在Java中,可以选择“创建构造函数匹配超级” (或类似的东西),它会自动创建构造函数。 Is something like that available for Scala? Scala可以使用这样的东西吗?

Example: 例:

class Foo(a:Int, b:Int)
class Bar extends Foo

I'd just hit some hotkey on Bar and it would generate this: 我刚刚在Bar上点了一些热键,它会产生这个:

class Bar(a:Int, b:Int) extends Foo(a:Int, b:Int)

As per the IntelliJ IDEA scala plugin version 0.22.302 nothing has changed in code generation functionality. 根据IntelliJ IDEA scala插件版本0.22.302,代码生成功能没有任何改变。 It has only got override & implement methods, companion object and toString options under code generation and no construction generation support yet. 它只在代码生成下获得了覆盖和实现方法,伴随对象和toString选项,并且还没有构建生成支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM