chengcyber / rollup-plugin-monaco-editor

A rollup plugin for importing monaco editor
MIT License
30 stars 4 forks source link

Support for monaco 0.34.0 #20

Closed Misiu closed 2 years ago

Misiu commented 2 years ago

Ref: https://github.com/esphome/dashboard/pull/300

The latest release of rollup-plugin-monaco-editor is compatible with monaco-editor up to version 0.31.1. For some reason, hovers (with docs and error descriptions) don't show up with the latest version of monaco (0.34.0)

glmnet commented 2 years ago

I tried running the gen script but failed

chengcyber commented 2 years ago

Hi @Misiu, I tried monaco-editor@0.34.0 locally and it works with this plugin. It will be helpful if you can provide a reproduce way.

glmnet commented 2 years ago

Hi @chengcyber did you get the hovers to work properly? I did not try to reproduce the bug in an isolated manner. I'm no expert but found that the path of many files changed here https://github.com/microsoft/vscode/commit/1498d0f34053f854e75e1364adaca6f99e43de08#diff-790d9803b8477b256b7f571260cda4f3d5b033b6405e3586bf3e98d08236087a and I believe this could cause stuff like this to break?

chengcyber commented 2 years ago

Hi @glmnet , thanks for the information.

Could you elaborate more on the hovers you are using? I want to understand your issue correctly and figure out which kind of thing is broken.

glmnet commented 2 years ago

https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-hover-provider-example

glmnet commented 2 years ago

TL;DR; this should be closed.

I managed to reproduce the bug, hovers works with 0.31.1 here and does not work with 0.34.0: https://github.com/glmnet/rollup-plugin-monaco-editor/blob/shadow-bug/example/index.js

Stuff just happened in a precisely manner which led me to wrongly conclude the issue was with this plugin.

Now all the fuzz about the shadowroot going on there: Lit Elements framework uses this shadowroot thing which I was not aware was causing this bug too. I am working on ESPHome dashboard project and found out that this shadow root also causes other issues (i.e. touch scroll not working on mobile browser) So I finally ended up loading monaco without shadowroot and now I realize 0.34 works ok with this plugin.

I failed to repro the bug without the shadowroot so this can be closed.

Sorry for the inconvenience.

chengcyber commented 2 years ago

Glad to know it works for you! 👏

Misiu commented 2 years ago

@chengcyber thank you for looking at this and for your time. @glmnet 💪