Code Monkey home page Code Monkey logo

Comments (10)

msftristew avatar msftristew commented on May 25, 2024

Scala support is in CodeMirror through this file, clike.js: https://github.com/codemirror/CodeMirror/blob/master/mode/clike/clike.js

However, when I set the mode to clike for Scala, I don't get correct highlighting/text editing behavior (none of the correct keywords are highlighted, and default indentation is incorrect unless I put a semicolon at the end of all my lines). Going to keep investigating.

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

Python taken care of through #104

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

In my testing, Scala isn't working even if I set the codemirror mode to "clike" and the MIME type to text/x-scala. For some reason CodeMirror isn't "getting" that what I type in is supposed to be Scala code and is instead applying some very simple, stupid syntax highlighting to it (i.e. only highlighting equals signs and integer literals). Can keep looking at this later.

from sparkmagic.

aggFTW avatar aggFTW commented on May 25, 2024

Hey @msftristew, any updates for this?

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

Scala and Python syntax highlighting are both working great. I haven't tested out SQL but it should be easy (@alope107's solution should be fine here)

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

There's an issue. See ipython/ipython#7548

It looks like only cell magics trigger magics syntax highlighting. I don't think that syntax-highlighted line magics are supported. This means that our SQL and Hive commands need to be %%sql and %%hive in order for syntax highlighting to kick in -- %sql and %hive won't work.

from sparkmagic.

aggFTW avatar aggFTW commented on May 25, 2024

Let's go with that for now and we'll investigate line magics in parallel.

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

Arguably all of the "magics" in our Spark kernel are cell magics, not line magics. So it breaks with convention less if we move to a model where %%sql, %%hive, %%config, etc. are the "normal" way to call things.

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

Still need to do this :(

from sparkmagic.

msftristew avatar msftristew commented on May 25, 2024

So, I have a branch going (kerneljs) which is supposed to fix SQL syntax highlighting. As it stands, on my Windows machine, SQL syntax highlighting works for the first cell but fails with an error message in the console for the rest.

image

image

I think this PR to jupyter/notebook (which hasn't made it into an official release yet) is supposed to fix this issue? Maybe? I don't know.

from sparkmagic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.