Scala 控制台不起作用,IntelliJ

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14677285/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 04:55:07  来源:igfitidea点击:

Scala console won't work, IntelliJ

scalaideconsoleintellij-idea

提问by BogdanC

I did all the preference work, installed scala, everything works except this, i just can not test a scala class in the console window.

我做了所有的偏好工作,安装了 Scala,除此之外一切正常,我只是无法在控制台窗口中测试 Scala 类。

In tutorials I see they just type in something behind the scala> but it just won't work, i can type some random stuff there below which doesn't do anything when I press enter.

在教程中,我看到他们只是在 scala> 后面输入了一些东西,但它不起作用,我可以在下面输入一些随机的东西,当我按下 Enter 键时它不会做任何事情。

Can you guys help me out? I would be very thankful. Cheers

你们能帮我吗?我会很感激的。干杯

回答by user1040804

Once you type on the Scala console in IntelliJ Community Edition. Hit Ctrl+Enterinstead of enter to execute.

一旦您在 IntelliJ 社区版中的 Scala 控制台上键入。按Ctrl+Enter而不是 Enter 来执行。

took me a while to get around it :)

我花了一段时间来解决它:)

IntelliJ & Working with Scala Worksheet

IntelliJ 与使用 Scala 工作表

回答by Rose Perrone

If you want the console to execute when you hit enter, go to Preferences > Keymap > Plug-ins > Scala, and right-click ScalaConsole.Execute. Select Add Bookmarkand hit enter in the first box. Then click Applyand then OK. enter image description here

如果您希望在按 Enter 键时执行控制台,请转到Preferences > Keymap > Plug-ins > Scala,然后右键单击ScalaConsole.ExecuteAdd Bookmark在第一个框中选择并按回车键。然后单击Apply,然后单击OK在此处输入图片说明

回答by Emerson Farrugia

You have to press ?-Enter on Mac OS X when you're done typing.

完成输入后,您必须在 Mac OS X 上按 ?-Enter。

回答by Sheng

I guess it's better to change the message from "Type in expressions to have them evaluated." to "Type in expressions and press Ctrl + Enter to have them evaluated."

我想最好将消息从“输入表达式以对其进行评估”进行更改。到“输入表达式并按 Ctrl + Enter 进行评估。”

回答by AlexPes

Just add scala sources to $PATH and it should be available / callable from CMD / Idea Terminal

只需将 scala 源添加到 $PATH,它应该可以从 CMD/Idea Terminal 获得/调用