问题
How can I configure IDEA to automatically replace =>
with ⇒
and ->
with →
?
回答1:
Take a look at this question and answer which makes use of IntelliJ's "Live Templates", in this case scalaz mappings in XML form saved as a file rather than entered from the GUI. This, I guess, is fine with scalaz as all the unicode aliased functions and methods are already present.
回答2:
Scalariform will do this for you (if appropriately configured). I would imagine that what you want is something that can auto-expand those sequences into the relevant unicode characters though as you type. I honestly don't know whether or not this is possible in IDEA.
回答3:
With IntelliJ 2016.1.4, which I am using, things has become easier.
File -> (Other Settings-> Default Settings) |Settings -> Editor -> Code Style -> Scala
Select tab Other
- select option
Replace => with unicode symbol
- select option
Replace -> with unicode symbol
However if one wants to support other unicode characters as in scalaz, then maybe, Live Template might still be the way to go. I haven't verified it.
With IntelliJ 2019.x.x, I recommend using Font Ligature along with Jetbrains Font like Jetbrains Mono especially when the use of unicode arrows are getting deprecated in Scala 2.13+. Besides, I found that the unicode symbol don't gel with Scala Repl.
回答4:
Please follow the steps in the image:
来源:https://stackoverflow.com/questions/7666206/how-can-i-configure-idea-to-automatically-replace-with-%e2%87%92-and-with-%e2%86%92