TypeFox / monaco-components

Monaco Editor and Language Client Wrapper, plus Monaco Editor React Component
MIT License
42 stars 13 forks source link

[Monaco Editor React Component] unavailable language server throws unhandled error #62

Closed Stainless2k closed 5 months ago

Stainless2k commented 7 months ago

When the component mounts and the language server is not available, an error get thrown but not caught, which then also seems to cause the onLoad not to fire. It would be nice if the error simply got caught and logged by the component.

The error thrown: ''' { "message": "languageClientWrapper (Python Language Server Example): Websocket connection failed.", "error": "No error was provided." } '''

kaisalmen commented 7 months ago

Hi @Stainless2k thank you for reporting this. Would you like to contribute a fix? Otherwise, I will fix it at some point (next week or so).

Stainless2k commented 7 months ago

@kaisalmen thank you for your quick answer, was on vacation the last weeks so i couldn't respond. I would love to contribute at some point, but sadly i don't have the time atm. I assume since this is still open it has not been fixed yet? Just asking because I have trouble finding the release notes for the repo :sweat_smile:

kaisalmen commented 7 months ago

@Stainless2k I haven't done it, yet. But, it will come...

kaisalmen commented 5 months ago

@Stainless2k fix will be available in next release. I just committed the fix. It is part of https://github.com/TypeFox/monaco-languageclient/pull/600 due to this: https://github.com/TypeFox/monaco-components/issues/66

kaisalmen commented 5 months ago

You need to have onError callback in place. If it exists the exception is forwarded there and everything works as you like it to be. The exception has meaning, so I don't want to hide it.

Stainless2k commented 5 months ago

thank you :+1: