如何修复IntelliJ IDEA方法参数自动完成?

2024-03-27

我正在使用 IntelliJ IDEA 15,我注意到(默认情况下)Eclipse 在编写需要多个参数的方法调用时提供了更方便的自动完成功能。

Eclipse 会自动填充默认参数,并允许您通过按快速浏览它们Tab


IntelliJ 不这样做,而且据我所知也没有一个插件。
没有适合您的解决方案(除非您自己构建了一个插件,但随后您就需要另一份工作来维护该插件)

另一种方法是打破习惯/需要并使用 IntelliJ 的代码完成快捷方式:

  • Ctrl+P to view possible parameters for function.
  • Ctrl+Shift+Space to list the possible variables that could be entered as a parameter in the respective parameter position (based on type).
    This also enters a comma if another parameter is required for the function.

Hardcoding numbers/strings as parameters to a custom function wouldn't be advisable as that negates the point of the parameters. It's better practice and more common to pass in a pre-defined variable; At which point Ctrl+Shift+Space is the easiest way for Code Completion.
This would also prevent you from closing quotations and adding commas.

另请注意:IntelliSense 是 Microsoft 的智能代码完成实现,IntelliJ 和 Eclipse 均未使用。


正如 frant.hartm 在他们的回答中所说:

不幸的是,Intellij 开发人员认为此功能太容易出错。在 youtrack 上查看此问题 https://youtrack.jetbrains.com/issue/IDEABKL-5496.

他们甚至声明欢迎人们制作一个插件来执行此操作。 https://youtrack.jetbrains.com/issue/IDEABKL-5496#comment=27-515010

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何修复IntelliJ IDEA方法参数自动完成? 的相关文章

随机推荐