How can I configure IDEA to automatically replace => with ⇒ and -> with →? [duplicate]

只愿长相守 提交于 2020-05-25 14:49:54

问题


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

  1. select option Replace => with unicode symbol
  2. 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:

steps.



来源:https://stackoverflow.com/questions/7666206/how-can-i-configure-idea-to-automatically-replace-with-%e2%87%92-and-with-%e2%86%92

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!