bgschiller / postgres_kernel

A simple Jupyter kernel for PostgreSQL
MIT License
64 stars 19 forks source link

Syntax highlight not working from 2nd cell #6

Closed mythical-programmer closed 5 years ago

mythical-programmer commented 7 years ago

The syntax highlight of SQL for the 1st cell is fine. But the highlight doesn't work from the 2nd cell onwards.

bgschiller commented 7 years ago

Huh, how about that. I'll try and take a look at this when I have time, but it's not a project I'm very active on. Anyone reading this is welcome to take a stab at it.

ps, sorry about the slow response, I was somehow not getting notifications of these issues.

BertrandBordage commented 6 years ago

It works with by changing language in kernel_json (in setup.py) from 'postgresql' to 'sql'.

Of course, you don’t get all the PostgreSQL specific syntax highlights, only standard SQL highlights. But that’s not really a problem, because Pygments, the library used for highlighting, doesn’t seem to add much PostgreSQL specific syntax, it doesn’t support WITH, for example.

The second cell issue itself is probably due to Jupyter because when I ask for Pygments to parse PostgreSQL two times using a same instance of PostgresLexer, it works correctly.

BertrandBordage commented 6 years ago

For an unknown reason, it also sometimes happen that a cell with 'sql' language does not get highlighted. Just save the notebook and reload the page…

bgschiller commented 6 years ago

Nice. Want to send a pull request? I'd be happy to merge it.

BertrandBordage commented 6 years ago

PR in #8.

bgschiller commented 5 years ago

Fix seems to be working in version 0.2.1