Conceal-like feature on SublimeText via Scalariver06 Nov 2014
Some are asking for a vim conceal feature on sublime text but as of now this doesn't exist. You can refer to the following for the threads
What made me interested in this is that scala have keywords that are better viewed like below.
I found out that I can that do that after I saw it from spray when I was scanning the code base.
That motivated me to find a tool that would reformat my source code this way. Luckily, I found a formatter that does just that. It's called scalariform and can be found here:
Refer here for the reason why I provided two links: https://groups.google.com/forum/#!topic/scala-ide-dev/65JHMO6Kkao
Format scala with Scalariform and ScalaFormat
Now the only problem left is how to apply this to my text editor. After consulting with Google, I found a plugin called ScalaFormat. You can find the source code here: https://github.com/timonwong/ScalaFormat. You can follow the instructions on how to install it from the link I've provided. You can also find how to setup the plugin to reformat arrow symbols. That's great, I thought and when I first tried it I thought that it hanged because nothing happened in two seconds. I was wrong and it did work the only problem is that it's really slow.
This is obviously unacceptable, this made me continue in my search until I found ScalaRiver. You can find it here: https://github.com/ornicar/scalariver.
Scalariver to the rescue
If you'll read its introduction, it is a server for scalariform that basically speeds up formatting of scala code by avoiding JVM warm up which is what plagued the first plugin I used in sublime. Just follow through the README to learn how to install it. The point of interest here is that a plugin for sublime text is available.
Configuring plugin for sublime text
I assume that you have installed scalariver server and running on localhost:8098.Then search the plugin, Scalariver, via sublime text package control and install it.
After successful install, you can configure the settings of the plugin by navigating to
Sublime Text > Preferences > Settings - User.This will open a tab in sublime with the file Preferences.sublime-settings. Add the following found below,
scalariver_url - This points to the scalariver service and in my case I had it installed locally.
scalariver_formantonsave - Activating this would let scalariver to format your source code after every save.
scalariver_options - Here, I only added the option to rewrite arrow symbols but there are alot more options available.
*Try it out on http://river.scalex.org *
What are you talking about?! this is not like VIM-conceal at all.
I agree with you on that. For now, this is the closest you can get on sublime text for scala. Honestly, it should be an editor feature and that is something we don't have right now.
You might also be interested on making a plugin that mimics this. Somewhat tried to do this for haskell and honestly, I haven't tried it so I wouldn't know if this works.