-
-
Notifications
You must be signed in to change notification settings - Fork 197
Fix: Multiple Monaco editor issue #666
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
Conversation
…editors with one language server now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for resolving this and updating the examples |
@kaisalmen is there also the option to have the react component twice and have them completely isolated from each other? |
@cdietrich each editor for a different LS/language? |
for the same language. see this branch: currently both workers seem to see the files from the other. |
I don't think it will be able, monaco/VSCode don't support having multiple isolated "instances" in parallel The closer you can get is having 2 workspace folders. You can configure a language client to match only a single workspace folder. |
We should add that to our Troubleshooting section |
hmm ok. so this is why monaco dispatches all events to all clients. |
An alternative can be to use Iframes also of course |
@cdietrich and @CGNonofr btw, you can use MessageChannels to communicate in between IFrames or to channel the communication between main and worker or between workers. You can configure this already: https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/src/langium/statemachine/main.ts#L35-L62 Idea: You could have logic either on client or the worker or both to disable communication to silence one LS. |
yeah but we basically would need very heavy rewrite to isolate on the server side |
@cdietrich disconnecting and re-connecting the languageclient on tab change is not an option? You don't have to dispose the worker. This should be fast. |
we need to check |
If something is missing, let us know. |
This fixes #620 It actually didn't require a code change. You only create one language client and the other editor re-uses the globally installed for the registered language (=
statemachine
in this case). This may have not been as easily configurable in the past.In addition the PR contains the update to monaco-vscode-api version
5.2.0