Get LanguageClient of LSP running in WebExtension #786
Replies: 8 comments
-
In addition, I execute custom commands with: monacoEditorRef.current?.executeCommand(...) ...which throw intial error messages because the |
Beta Was this translation helpful? Give feedback.
-
@P422L is this web extension created by you? You need to communicate with that extension somehow, because it runs isolated from your editor code above. A |
Beta Was this translation helpful? Give feedback.
-
@kaisalmen Thank you for your quick reply. Yes it is my extension and I have tried both the I lack a bit of understanding of how to connect my React component with my Monaco Editor (running in a worker) to the LanguageClient (running in a worker in a WebExtension). The approach with the MessageChannel sounds good, but as far as I understand it I have to pass it, otherwise I can't communicate on the same channel. Do you have a short example? |
Beta Was this translation helpful? Give feedback.
-
@kaisalmen I would still appreciate a small code snippet that shows me how to set up the communication to an extension in a webworker. 😅 |
Beta Was this translation helpful? Give feedback.
-
@P422L sorry, I don't have a ready example for your problem. I am working on PR #734 where the languageclient / server communication and the file exchange is routed via message channels. This is still WIP. This is not exactly what you need, but may help. You need to pass the message port via a transferables to a worker. You can pass the two ports of a channel to different workers and then use that channel for inter-worker communication. |
Beta Was this translation helpful? Give feedback.
-
@kaisalmen unfortunately, that doesn't really help me. My problem is that I don't understand how I can continuously pass something to a worker in a web extension. |
Beta Was this translation helpful? Give feedback.
-
@pbrostean / @P422L I have to see if I can find an example. |
Beta Was this translation helpful? Give feedback.
-
As this is not an issue but rather a question for help i think this can be closed and reopened for discussion if needed. |
Beta Was this translation helpful? Give feedback.
-
Description
I have created a
MonacoEditorReactComp
with the followinguserConfig
:The LSP functionalities work as expected, meaning my Monaco editor is definitely connected to the
LanguageClient
from the.vsix
file, and thisLanguageClient
is also connected to theLanguageServer
running in the extension.Use Case
I need to react to a custom state of the
LanguageClient
, meaning I need a way to communicate between theLanguageClient
and my editor. Currently, I only see options to access theLanguageClient
and the connection when I create it in the config, but not when I want to access aLanguageClient
in an extension.Question
How can I obtain the connection details for a
LanguageClient
that is running in an extension, so I can communicate with it from my editor? Is there no way I can access it via the id?Beta Was this translation helpful? Give feedback.
All reactions