如何在IntelliJ IDEA中关闭单元返回类型的Scala自动完成功能? [英] How to turn off Scala auto-completion of function with Unit return type in IntelliJ IDEA?

查看:604
本文介绍了如何在IntelliJ IDEA中关闭单元返回类型的Scala自动完成功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ IDEA Scala插件具有自动添加:Unit 到单元返回功能结束的功能。所以,例如,如果我正在写一个副作用函数 foo

IntelliJ IDEA Scala plugin has a feature for automatically adding :Unit to the end of unit-returning functions. So, for example, if I'm writing a side-effecting function foo:

def foo() {}

当我点击 Enter 当光标在大括号之间时,我会得到以下内容:

when I hit Enter while the cursor is between the braces, I'll get the following:

def foo():Unit = {

}

我个人更喜欢以下内容:

I, personally, prefer the following instead:

def foo() {

}

那么,我该如何关闭此功能呢?

So, how do I turn this feature off?

推荐答案

tldr;
Preferences > Code Style > Scala > Other > Uncheck: Enforce procedure syntax [blah blah blah]




  1. 打开IntelliJ 偏好设置对话框

  2. 在右侧面板中展开代码样式

  3. 选择 Scala

  4. 点击标题为其他的标签

  5. 取消选中为单位返回类型的方法强制执行过程语法

  1. Open IntelliJ Preferences dialog
  2. In the right panel expand Code Style
  3. Select Scala
  4. Click on tab titled Other
  5. Uncheck Enforce procedure syntax for methods with Unit return type

这篇关于如何在IntelliJ IDEA中关闭单元返回类型的Scala自动完成功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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