-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
how to use webview with monaco-languageclient #882
Comments
Hello, monaco-languageclient is based on monaco-vscode-api, which supports everything that VSCode support in web mode, including webviews. The proper service-overrides need to be loaded, then you'll be able to load your extension using webviews. Either by calling the |
Thank you for your answer @CGNonofr, if I may ask, is there any way to find out which one is the correct override? Additionally it would be nice if I could just mount the webview onto a container already reserved on the webpage that monaco is running on to, instead of loading the complete vscode extension - is there support for that? |
More specifically, there’s this function acquireVsCodeApi which is supplied by some magic to webviews. My question basically amounts to where I can find that magic and how to use it to pass that function to the component that would be running in the webview |
Not really, you can start by adding the obvious ones then add the missing ones when you notice an issue or a missing feature
It doesn't work that way, the point of webview is to let the user manipulate them, move them or close them. If you just want to render an iframe in your container, why aren't you doing it yourself?
acquireVsCodeApi just provides 3 methods (getState, setState and postMessage), all relying on postmessages, so it can probably easily be implemented by hands though, depending on what you're trying to do |
I try to, the issue is that the webview loses the ability to talk to vscode, i.e. the webview tries to use vscode-messenger to talk to the editor and that needs the I would be happy to implement that part myself, however I don't know enough about vscode to know what should go there. |
I'm sorry, that's too advanced for me to be able to help you. The best documentation is the code itself though :) |
if you're speaking in terms of this code, then I'm willing to believe you, if you're speaking in absolute terms, perhaps you can tell that the knowledge of an interface having three methods isn't quite enough to implement it ;) Thank you for your help though. I will try to use an actual webview for now. |
Hi - I would like to ask whether or not it is possible to use the vscode webview with monaco-languageclient or if there's an example for that around? I see that there's some code for it but I don't understand how to use it.
I'm also wondering if I'm missing some place for documentation of this project? All I could find were the examples and they are all kind of incomplete if one is trying to implement all of an extension without actually loading up the bundled extension.
Thank you so much in advance, an answer is much appreciated!
The text was updated successfully, but these errors were encountered: