2017-12-12 1 views
0

Scalaパターンマッチングで使用する一般的な記号は、右矢印です(⇒または=>)。だから私の質問は、右の⇒見た目のすっきりしたタイプのショートカットは何ですか?私はMac OS上でIntelliJを使用します。以下IntelliJ Mac OSで右矢印(⇒、not =>)を入力するにはどうすればよいですか?

あなたがそれを書いた後、自動的に=>を変更するScalariformのようなツールを使用して、このシンボルを使用https://doc.akka.io/docs/akka/current/guide/tutorial_1.html

package com.lightbend.akka.sample 

import akka.actor.{ Actor, Props, ActorSystem } 
import scala.io.StdIn 

class PrintMyActorRefActor extends Actor { 
    override def receive: Receive = { 
    case "printit" ⇒ 
     val secondRef = context.actorOf(Props.empty, "second-actor") 
     println(s"Second: $secondRef") 
    } 
} 

object ActorHierarchyExperiments extends App { 
    val system = ActorSystem("testSystem") 

    val firstRef = system.actorOf(Props[PrintMyActorRefActor], "first-actor") 
    println(s"First: $firstRef") 
    firstRef ! "printit" 

    println(">>> Press ENTER to exit <<<") 
    try StdIn.readLine() 
    finally system.terminate() 
} 

答えて

4

ほとんどのプロジェクトから⇒を使用するサンプルコードです。

個人的には、良い矢などを表示するために、合字のフォント(Fira Codeなど)を使用することを好みます。

2

[設定]タブ(Linuxではファイル=>設定、おそらくMac OSでは同じ/類似)では、エディタ=>ライブテンプレートでライブテンプレートとして追加します。

See here for more info

関連する問題