-
I want to create a VS Code extension that extends the existing XML extension by Red Hat (redhat.vscode-xml) and allows visual editing of XML schemas and possibly XML files bound to a schema (similar to Altova XML Spy). I hope that I can benefit from the XML language server integrated by the XML extension regarding things like what can be added at this point in the file and highlighting errors. How would I tackle this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I think there are two independent aspects: (a) how to get the data you need from redhat.vscode-xml and (b) how to make use of this data in GLSP. The GLSP side of things (b) is rather straightforward. From the perspective of GLSP, you can do whatever you want in your source model storage implementation, whether you open a socket to another process (e.g. a language server) and query data, query a database, read a file... this is all up to you. In the source model storage, you eventually need to obtain the data that you need for generating a graphical model later in your implementation of the GModelFactory. Thus in your case, your source model storage implementation would need to obtain the data you need from the language server, put it in the model state and then later process this in the GModelFactory to create a digaram. How to obtain the data from the language server of redhat.vscode-xml (a) is rather outside of the scope of GLSP and depends on your intended architecture and the VS Code extension, or rather the language server implementation. From the top of my head, I'd consider the following options: One way could be to make your language server accept additional connections so that the GLSP server and the XML LSP can exchange messages. If you can't easily control the language server, you could send a custom action to the client (i.e. your webview) and have a dedicated client action handler for this action type, which posts a message to VSCode ( The latter is also how sprotty-vscode does it: |
Beta Was this translation helpful? Give feedback.
I think there are two independent aspects: (a) how to get the data you need from redhat.vscode-xml and (b) how to make use of this data in GLSP.
The GLSP side of things (b) is rather straightforward. From the perspective of GLSP, you can do whatever you want in your source model storage implementation, whether you open a socket to another process (e.g. a language server) and query data, query a database, read a file... this is all up to you. In the source model storage, you eventually need to obtain the data that you need for generating a graphical model later in your implementation of the GModelFactory.
Thus in your case, your source model storage implementation would need to obtain the …