Reimplementing an EMF Browser based on LSP Server #512
-
Hi, we currently have a native eclipse RCP browser (implemented with org.eclipse.jface.viewers.TreeViewer) that allows us to search for a particular EObject (the displayed contents are EMF models) and show its relations to other objecs in a tree viewer and its members on another one. One can as well as to navigate though those. Since were are moving the DSL implementations to an Xtext-LSP server, we will not have the ecore models and its generated classes bundled with the eclipse RCP, and are looking for a way to reimplement the browser based on information coming from the LSP Server. After exploring https://www.eclipse.org/emfcloud/#components it is unclear if GLSP is the right technology to base the browser as we will use LSP but do not need an SVG Editor where each editor edits as model described in a file. Instead we have a viewer to display and browse information defined across many sources. Would GLSP suited for our use case? Should I rather look at EMFForms, which offers table editors (which can be then turned read-only)? Or since I do not have a 1 to 1 relationship between the data displayed and a source, I am better by keeping the TreeViewer implement and have custom JsonRequest on my LSP Server to access the data required? If so, should I use EMF JSON-Jackson to serialize the EMF objects I want to retrieve? I would be very thankful for some hints on which direction I should look at initially. You have probably noticed, I am quite lost :) Regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, Imho, neither GLSP nor EMFForms seems to be a direct fit for your requirement. For your use case, I would suggest adding a custom request to your Xtext-based language server allowing to query the relations of an object to other objects. Your tree view could then query the language server and invoke this custom request to retrieve the information required for the view. EMF JSON Jackson is probably not a great choice as LSP4J are using Gson for JSON serialization; so if you'd use EMF JSON-Jackson you'd have to add an unnecessary serialization/deserialization step. Instead I'd use Gson to be directly compatible to LSP4J and register your own adapters (see for instance the GLSP GModel GSON integration). Additionally, I think it may not be a great practice to send entire EObjects in your use case, as the language server should expose as little as possible in order to drive the required UI. So slimmer POJOs might be preferable to sending the full EObjects of your DSL. This would be more in line with the philosophy of LSP, which e.g. also doesn't expose the AST but rather trims the information down to UI-oriented information. |
Beta Was this translation helpful? Give feedback.
Hi,
Imho, neither GLSP nor EMFForms seems to be a direct fit for your requirement.
For your use case, I would suggest adding a custom request to your Xtext-based language server allowing to query the relations of an object to other objects. Your tree view could then query the language server and invoke this custom request to retrieve the information required for the view. EMF JSON Jackson is probably not a great choice as LSP4J are using Gson for JSON serialization; so if you'd use EMF JSON-Jackson you'd have to add an unnecessary serialization/deserialization step. Instead I'd use Gson to be directly compatible to LSP4J and register your own adapters (see for instance the GLSP GModel GSO…