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

Fixes Syntax Highlighting #19

Merged
merged 16 commits into from
Feb 26, 2023
Merged

Conversation

AnotherCodeArtist
Copy link
Contributor

Hi @fcollonval!

Thanks for integrating my latest PR so quickly and to come up with a new release immediately after. I upgraded my images and ran into another problem (at least with Golang/Gophernotes notebooks).
All code was there, but some of the code cells weren't syntax highlighted. Thus, I started to dig into the problem. First thought was that it's possibly a problem with codemirror and its integration into jupyterlab itself, which caused me to consistently upgrade all jupyterhub/* dependencies to the latest 3.x version (3.6.1.). But no success.
Looks like codemirror uses the same promise to kick-in. which apparently leads to a sort of race-condition with initializeReveal, leaving some of the cells raw text (unless clicking into them).
Best solution I could find is to add some extra delay (500ms currently) before calling initializeReveal, which fixes the issue.

      notebookPanel.context.ready.then(() => {
        setTimeout(() => {
          initializeReveal(null, {
            name: 'dirty',
            newValue: notebookPanel.model?.dirty ?? true,
            oldValue: true
          })
        }, 500);
      });

It's definitely not the smartest approach, but I couldn't find another callback/trigger that would indicate the end of syntax highlighting.

It would be cool if you could again publish a new release soon!

@github-actions
Copy link

Binder 👈 Launch a Binder on branch AnotherCodeArtist/rise/main

@fcollonval fcollonval added the bug Something isn't working label Feb 22, 2023
@fcollonval
Copy link
Member

Thanks @AnotherCodeArtist for your contribution

Could you try loading the CodeMirror mode ahead of initializeReveal?

You can achieve this with something like:

import { Mode } from '@jupyterlab/codemirror';

// ...
await Mode.ensure(notebookPanel.content.codeMimetype);
initializeReveal(...)

Could you also revert all changes except that one?

@AnotherCodeArtist
Copy link
Contributor Author

Hi Frédéric @fcollonval!

Thank's for your support! Works like a charm now. Although, I ended up with eslint using internally a different, conflicting version of prettier. Thus, what was fixed by prettier was seen as an error by eslint and vice versa. Eventually I upgraded both to the latest version, which fixed this problem.

@AnotherCodeArtist
Copy link
Contributor Author

Hi @fcollonval!

Is there any chance to release this new version over the weekend? I desparately need a working version by Monday afternoon.

@fcollonval fcollonval merged commit 89d0e43 into jupyterlab-contrib:main Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants