fsprojects / IfSharp

F# for Jupyter Notebooks
Other
442 stars 71 forks source link

Unreliable IntelliSense and CSS #135

Closed sylvanc closed 7 years ago

sylvanc commented 7 years ago

Cross posting from here:

https://github.com/Microsoft/AzureNotebooks/issues/37

The issue appears to be more than just IntelliSense. Occasionally, the syntax highlighting stays in the default mode (keywords are green) instead of using the F# CSS (keywords are blue). When that happens, IntelliSense also doesn't work.

It's not kernel-side, as reloading the page (while leaving the kernel running) will often fix the issue for that session.

cgravill commented 7 years ago

I've done a few tests with a Chrome Incognito mode and locally I'm sometimes able to get issues like:

image

and

image

it's possible they may be related

cgravill commented 7 years ago

I've looked into this some more and we seem to be missing some require.js defines http://requirejs.org/docs/api.html#define which is causing the load order to race. It's going to need a bit of effort to sort through the dependency chain and how it interacts with the CodeMirror lazy loading https://codemirror.net/demo/loadmode.html e.g. the CodeMirror.requireMode in fsharp.js relies on the loadmode having been loaded without that being explicit hence the second error above.

cgravill commented 7 years ago

I've simplified the way we configure Code Mirror and enforced a strict order in loading the of the dependent scripts. It's now reliable for me under load, and fresh loads in private mode windows. A side-effect is highlighting waits on kernel load, it might be possible to get it to take effect sooner but this is reliable for me at least.

Could you confirm it works for you please?

sylvanc commented 7 years ago

Nice! Works for me every time :)