Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting in jupyterlab not working anymore #436

Open
ozak opened this issue Mar 19, 2024 · 10 comments
Open

Highlighting in jupyterlab not working anymore #436

ozak opened this issue Mar 19, 2024 · 10 comments

Comments

@ozak
Copy link

ozak commented Mar 19, 2024

The kernel used to have syntax highlighting, which was installed with

conda install -c conda-forge nodejs -y
jupyter labextension install jupyterlab-stata-highlight

which is not supported anymore by jupyter. Will this be updated? Actually, is this project still being maintained? I see there have been no updates in 2 years.

@mcaceresb
Copy link
Collaborator

@ozak That's my bad; I haven't given it any attention in some time. What's your Stata versoin?

@ozak
Copy link
Author

ozak commented Mar 20, 2024

I am using Stata 18. But I think the issue is the change of "architecture" in jupyter-lab>=4.0 and notebook>=7.0.

@ozak
Copy link
Author

ozak commented Mar 20, 2024

The extension keeps asking to be built,

image

But when I try to build it, I get the following error message:

Build failed with 500.

        If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').

        If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.


@mcaceresb
Copy link
Collaborator

@ozak Is the issue specifically that this works with jupyter-lab<4.0 but not jupyter-lab>=4.0?

@ozak
Copy link
Author

ozak commented Mar 21, 2024

I think so. I am unsure which version broke it exactly.

@mcaceresb
Copy link
Collaborator

@ozak Ok. I'm trying to test it out but I'm having problems with all the dependencies, given the bulk of the codebase hasn't been updated in a bit. I'll try and get this working with newer versions of all the dependencies soonish.

@ozak
Copy link
Author

ozak commented Mar 21, 2024

Great Thanks!

@hugetim
Copy link

hugetim commented Mar 28, 2024

Related: kylebarron/jupyterlab-stata-highlight#15

Instructions for a workaround meanwhile: hugetim/jupyterlab_stata_highlight2#4 (comment)

@ozak
Copy link
Author

ozak commented Apr 10, 2024

Tried it and didn't work in my install.

@ticoneva
Copy link

I have verified that the following steps should work:

  1. Create and activate conda environment.
    conda create -n jupyterlab4 pip nodejs -c conda-forge
    conda activate jupyterlab4
  2. Install Jupyter Lab 4.
    conda install jupyterlab -c conda-forge
    or
    pip install jupyterlab
  3. Set up the staging files. Make sure you are the owner of the environment, otherwise this will fail.
    jupyter lab build --dev-build
  4. Download Stata syntax highlighting Javascript file.
    wget https://raw.githubusercontent.com/ticoneva/codemirror-legacy-stata/main/stata.js -P $CONDA_PREFIX/share/jupyter/lab/staging/node_modules/@codemirror/legacy-modes/mode/
  5. Modify $CONDA_PREFIX/share/jupyter/lab/staging/node_modules/@jupyterlab/codemirror/lib/language.js. Search for Squirrel and add the following entry after that one:
           {
                name: 'stata',
                displayName: trans.__('Stata'),
                mime: 'text/x-stata',
                extensions: ['do','ado'],
                async load() {
                    const m = await import('@codemirror/legacy-modes/mode/stata');
                    return legacy(m.stata);
                }
            },
  1. Run jupyter lab build again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants