0

I'm looking for a way to highlight my SQL code in Jupyterlab, .

Also, I have seen that Jupyterlab proposes an advanced settings editor, but I did not find any information in that way.

require(['notebook/js/codecell'], function (codecell) {
    codecell.CodeCell.options_default.highlight_modes['magic_text/x-mssql'] = { 'reg': [/%?%sql/] };
    Jupyter.notebook.events.one('kernel_ready.Kernel', function () {
        Jupyter.notebook.get_cells().map(function (cell) {
            if (cell.cell_type == 'code') { cell.auto_highlight(); }
        });
    });
});

My environment version:

jupyter core     : 4.6.1
jupyter-notebook : 6.0.0
qtconsole        : not installed
ipython          : 7.10.1
ipykernel        : 5.1.3
jupyter client   : 5.3.3
jupyter lab      : 1.2.1
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 4.4.0
traitlets        : 4.3.3

Is there any way to get this kind of results? With magic-cells ? Or an extension?

enter image description here

Also, I have seen that Jupyterlab proposes an advanced settings editor

enter image description here

Thank you !!!

JulioY
  • 21
  • 4
  • [JupyterLab-LSP](https://github.com/krassowski/jupyterlab-lsp) automatically detects language for certain cell magics (including `%%sql`) and switches code editor mode. Related: https://github.com/jupyterlab/jupyterlab/issues/8879 https://stackoverflow.com/questions/57966403/how-to-add-syntax-highlight-to-sql-line-magic-cell-magic-and-custom-command-in – krassowski Feb 08 '21 at 22:00
  • Thank you @krassowski! I answered you directly on the Github ticket :) – JulioY Feb 10 '21 at 13:59

0 Answers0