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

Codemirror: simultaneous calls to EditorView.update during blur #2548

Closed
fonsp opened this issue Apr 27, 2023 · 7 comments
Closed

Codemirror: simultaneous calls to EditorView.update during blur #2548

fonsp opened this issue Apr 27, 2023 · 7 comments
Labels
bug Something isn't working frontend Concerning the HTML editor

Comments

@fonsp
Copy link
Owner

fonsp commented Apr 27, 2023

image

Probably since #2540

Maybe we can fix #2518 at the same time, it seems related

@fonsp fonsp added bug Something isn't working frontend Concerning the HTML editor labels Apr 27, 2023
@Pangoraw
Copy link
Collaborator

This is fixed in 9c052d3 too?

I updated codemirror in #2526 to get the diagnostics, but did not get this issue again.

@fonsp
Copy link
Owner Author

fonsp commented Sep 18, 2023

Ahh yes looks like this is probably outdated, go ahead with JuliaPluto/codemirror-pluto-setup@1b869d8 !

@fonsp fonsp closed this as completed Sep 18, 2023
@fonsp
Copy link
Owner Author

fonsp commented Sep 18, 2023

Yeah I got it again while adding a cell:

image

@fonsp fonsp reopened this Sep 18, 2023
@fonsp
Copy link
Owner Author

fonsp commented Sep 18, 2023

But the stacktrace looks helpful! Something related to the blur stuff, probably related to 9c052d3

@fonsp fonsp changed the title Codemirror bugs Codemirror: simultaneous calls to EditorView.update during blur Sep 18, 2023
@Pangoraw
Copy link
Collaborator

It's this dispatch which gets run during a CM update:

// then it's caused by focusing something other than this cell in the editor.
// in this case, we want to collapse the selection into a single point, for aesthetic reasons.
view.dispatch({
selection: {
anchor: view.state.selection.main.head,
},
scrollIntoView: false,
})

we can maybe do something like this to run the update in the next tick:

https://github.com/jupyter-lsp/jupyterlab-lsp/blob/3fb68dbab1ef52d1c3a65991755c2f24bf297bf7/packages/jupyterlab-lsp/src/features/highlights.ts#L155-L160

@fonsp
Copy link
Owner Author

fonsp commented Sep 18, 2023

Perfect I'll try that!

@fonsp fonsp closed this as completed in 62f7898 Sep 18, 2023
@fonsp
Copy link
Owner Author

fonsp commented Sep 18, 2023

that worked yay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Concerning the HTML editor
Projects
None yet
Development

No branches or pull requests

2 participants