tribbloid / ISpark

An Apache Spark-shell backend for IPython
Apache License 2.0
106 stars 29 forks source link

Scala syntax highlights in the ipython 3.1.0-cbccb68 #16

Open rzykov opened 9 years ago

rzykov commented 9 years ago

We found that scala syntax highlight works in ipython 3.0.0, but doesn't work in ipython 3.1.0-cbccb68 I think it caused by this commit in ipython https://github.com/ipython/ipython/pull/6793

tribbloid commented 9 years ago

Thanks a lot. This proves my speculation, a patch is already on the way. It's interesting to see that ipython#6793 is also half done: when you first switch the kernel it uses kernelspec, if you open the notebook again it uses kernel_info May I ask an off-topic question? The comment shortcut "ctrl-/" seems to use python's "#" instead of codemirror's "//" on scala kernel, does #6793 also fix the comment shortcut problem?

rzykov commented 9 years ago

I have a Mac, CMD-/ comments line correctly with "//" under ipython 3.0.0

tribbloid commented 9 years ago

Good! so theoretically I can fix both, give me a few days :) Thanks a lot buddy

On 04/30/2015 05:13 AM, rzykov wrote:

I have a Mac, CMD-/ comments line correctly with "//" under ipython 3.0.0

— Reply to this email directly or view it on GitHub https://github.com/tribbloid/ISpark/issues/16#issuecomment-97715810.

tribbloid commented 9 years ago

OK, it looks like the workload is more than I expected: The IPython server has an built-in adapter to convert messaging protocol v4 to v5. But its not very well rounded (some conversions are incomplete, like autocompletion and kernel_info_reply), so I either upgrade the entire protocol to v5, or tolerate the incomplete adapter. I'll gradually implement the new protocol and try to reach the author of IScala, see if I can backport the new protocol.

Thanks a lot

tribbloid commented 9 years ago

I've updated the messaging protocol to the latest version but seems like it doesn't help anything. Here is my post for the problem:

http://python.6.x6.nabble.com/kernel-info-reply-is-ineffective-on-code-highlighting-td5095065.html

Any help is appreciated. Also, the latest messaging protocol has been committed to IPython-3.x branch, so please be sure that you've checkout that branch before testing.

tribbloid commented 9 years ago

OK, now I can confirm that the kernel/messaging is working properly. The problem is caused by notebook codemirror javascript which always returns /codemirror/mode/clike/clike.js The problem has been reported in IBM spark-kernel before: https://github.com/ibm-et/spark-kernel/issues/109 Now I just need to find the frontend solution. @rzykov: since you have observed syntax highlighting on IPython 3.0 I think your codemirror javascripts are already fixed. Could you help me test the latest build again or tell me how to override clike.js being used for Scala?