IntelliJ可以在“new”上自动完成构造函数参数表达? [英] Can IntelliJ auto-complete constructor parameters on "new" expression?

查看:2638
本文介绍了IntelliJ可以在“new”上自动完成构造函数参数表达?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的类有非空构造函数,是否可以在 new 表达式中自动完成参数?

If my class has a non-empty constructor, is it possible to auto-complete parameters in the new expression?

使用Eclipse时,如果在光标位于括号之间时按 ctrl + space

With Eclipse, if you press ctrl+space when the cursor is between the parenthesis:

MyClass myObject = new MyClass();

它会找到合适的参数。

-->  MyClass myObject = new MyClass(name, value);

当我使用 ctrl + shift +在 new 之后的空格键,Intellij向我展示了构造函数,但我不能选择一个用于自动完成。我错过了一个选项吗?

When I use ctrl+shift+spacebar after the new, Intellij shows me the constructors, but I can't choose one for auto-completion. Am I missing an option?

推荐答案

在Intellij Idea 2016.3中你可以使用选项 + 返回。它会询问您是否要为您所在的参数和所有关注者引入命名参数。

In Intellij Idea 2016.3 you can use option + return. It will ask you if you want to introduce the named argument for the argument you are on and all the followers.

这篇关于IntelliJ可以在“new”上自动完成构造函数参数表达?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆