Skip to content
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

Language Server Protocol #3

Open
thorade opened this issue May 9, 2017 · 17 comments
Open

Language Server Protocol #3

thorade opened this issue May 9, 2017 · 17 comments

Comments

@thorade
Copy link

thorade commented May 9, 2017

This whole Modelica-Tool-Ensemble looks interesting, but I do not really understand what it does or how it works...
Do you have an introductory text? Conference paper?
Maybe a YouTube video of the components in action or similar?
Is this something similar (or even related to) the "Language Server Protocol"?
http://langserver.org/

@thorade
Copy link
Author

thorade commented May 10, 2017

OK, I just saw that there will be two presentations in Prague at the Modelica Conference 2017:
http://dx.doi.org/10.3384/ecp17132809
http://dx.doi.org/10.3384/ecp17132815

And, I found your webpage:
https://thm-mote.github.io/

@njustus
Copy link
Member

njustus commented May 10, 2017

Hey

  1. there is our website. The website contains instructions to install MoVE and Mo|E.
  2. there are two papers submitted to the 17th International Modelica Conference
  • Paper about Mo|E: “Mo|E – A Communication Service Between Modelica Compilers and Text Editors“
  • Paper about MoVE: "MoVE – A Standalone Modelica Vector Graphics Editor"

I’m going to talk about this papers on Wednesday (May 17th) at the conference.
Meet me there if you like.

In short:
MoVE is a graphical editor for the icon annotation of Modelica models.
Mo|E is an integrated development environment for Modelica.
It enhances the text editor Atom to a Modelica IDE.
In order to use it you need OpenModelica, Atom,
the Atom plugin and the server release.

We don't have a YouTube video at the moment.

Mo|E wasn't intended to be like the language server protocol
but it is really similar. You could say we built our own
language server protocol.

@thorade
Copy link
Author

thorade commented May 11, 2017

Thanks, I will try to attend your presentations!
How similar is "really similar"? Similar enough to make it compatible? Maybe you could profit from some previous work?
Closing for now, as there is no action required.

@thorade thorade closed this as completed May 11, 2017
@thorade
Copy link
Author

thorade commented May 30, 2017

I attended your talks in Prague and I really liked how the editor looked like and the support it gives to the user, BUT:

The more I think about it, the more I am sure that using the language server protocol (LSP) would make a lot of sense here. Their homepage has a list of supported languages and clients:
http://langserver.org/
Atom is already in the list of supported LSP clients.
Here is the repository (seems to be official, as it is from the atom organization):
https://github.com/atom/atom-languageclient

So by implementing a Modelica server (or, Dymola-server, OpenModelica-server and JModelica-server?) you would get Modelica support in quite a bunch of editors right away, including Atom:
https://github.com/Microsoft/language-server-protocol/wiki/Tools-supporting-the-Language-Server-Protocol

@thorade thorade reopened this May 30, 2017
@njustus
Copy link
Member

njustus commented May 31, 2017

I had a deeper look into the LSP and it has its benefits.
We get support in more editors but the whole communication is getting more complex because the LSP is much more complex than our HTTP protocol. As long as we don't have to implement the client side, that doesn't matter.

I'm not sure if the atom plugin is working right away. For me it looks like we would have to rewrite our plugin and using this (npm?) package. In any case we are going to consider this approach in the future. LSP looks really promising. Because we are in the middle of the semester I don't have the time to do it know. May be in fall.

But first I would like to make the whole installation process more easy. Unfortunately I don't know how, because the most complex part is setting up OpenModelica..

I'm glad that you liked the system and thanks for the informations about the LSP.

@thorade
Copy link
Author

thorade commented Jun 1, 2017

Thanks for considering.
The Atom LSP client seems to be under development, but as it seems to be "official" and given the Atom development speed in the past, it might be ready to use in the near future.
Until then and for testing, one could use VS Code.

What exactly do you consider too complicated in the OpenModelica installation? Windows or Linux?

@njustus
Copy link
Member

njustus commented Jun 1, 2017

There are a few things I consider complicated in OpenModelica. The installation itself is a little bit tricky on Linux (except for Ubuntu) and especially hard on OSX. I had to built from source and that was quite a pain and took me over an hour. Sadly I don't even know the problems anymore.. (Another problem is, that there is uninstaller for OSX.) Installation on Windows doesn't seem to be a problem, except finding the installed omc executable.

It would be ideal if we could automate the whole installation process by downloading 1 executable. My big vision is that the user installs the Atom plugin and the whole system is set up automatically while setting up the Atom plugin. But that doesn't seem possible.

The current installation procedure is like this:

  1. Install OpenModelica
  2. Install the Atom plugin
  3. Let the plugin fetch the MoPE server
  4. configure server
  5. configure plugin

I would like to reduce the whole process..

@thorade
Copy link
Author

thorade commented Jun 2, 2017

There are rpm packages for Fedora/RHEL/CentOS:
https://openmodelica.org/download/download-linux
These can be installed easily using yum. Maybe install alien also.
yum is also available for other distros, and should work e.g. on Suse, but I have never tried that.
What distro are your users using?

Maybe you could run OpenModelica in a Docker container?
Then users need to install Docker and just pull your image?

After some editing, the users would probably want to simulate, so they need a regular OpenModelica anyway, I would say. Or are you planning to also run simulations from Atom? If so, you could have a look at the hydrogen package, it connects to Jupyter kernels from Atom:
https://atom.io/packages/hydrogen

@CSchoel
Copy link
Member

CSchoel commented Jun 2, 2017

You are right, currently MoPE is mainly targeted at users who already have OpenModelica installed, but want to use a more comfortable editor for their code.

In the future, we would like to tailor it a little more towards teaching Modelica to students. This is where a simpler installation process would really help. In some courses we will probably only use Modelica for one or two exercises, so a full installation of OpenModelica may be a little bit of an overkill for students.

We are currently playing around with the idea of hosting Modelica sessions on a web server. With MoPE it should be fairly easy to communicate with an OMC on a different machine, but we would probably need to spawn a new instance of OMC for each user, which could provide some challenges. It would also make sense to have a similar tool for simulating models in a web browser.

The main problem is that the MoPE-Team consists of a bright student, who created this project for his thesis and will now move on to other tasks (Nico) and a chronically overworked PhD student (myself). 😉 We may be able to include a few bugfixes and small features, but for any larger improvements or changes we would first have to find another Student who is willing to work with Modelica - wich is hard precisely because of the reasons why we started our effort for MoTE in the first place.

I think I will hold on to the idea of using the LSP for MoPE as well as running the MoPE server on a different machine than the client. Both seem to be nice topics for a thesis that are worth investigating.

@thorade
Copy link
Author

thorade commented Jun 28, 2017

Note: I just suggested the same to the OpenModelica developers:
https://trac.openmodelica.org/OpenModelica/ticket/4458

@thorade
Copy link
Author

thorade commented Sep 13, 2017

@thorade thorade changed the title Q: Where can I learn more? Language Server Protocol Nov 27, 2017
@njustus
Copy link
Member

njustus commented Dec 2, 2017

So I had the time to implement parts of the LSP inside the server (see branch lsp).
The LSP itself is working correctly and compilation, code completion, go to definition, and hover for documentation is working.
Compilation is triggered automatically through a didSave event.

I tested this using Atom and at least in Atom the html documentation is not rendered correctly. It seems like the Atom lsp package does not support html at the moment.

There are still some features missing:

  • For checking a model we need a language-specific/custom command.
  • type informations on hover are not provided yet.

@thorade
Copy link
Author

thorade commented Dec 3, 2017

Nice! I hope LSP documentation is good and it was not too much work to implement this. I'll try to find some time soon to test it. Maybe VSCode is also good a good chocie on the client side for testing, their LSP implementation might be more mature that that in Atom:
https://langserver.org/#implementations-client

@thorade
Copy link
Author

thorade commented Feb 28, 2019

@atrosinenko This might be interesting as well!
modelica/ModelicaStandardLibrary#2837 (comment)
Did you share your code on github?

@atrosinenko
Copy link

atrosinenko commented Feb 28, 2019

Unfortunately, it would hardly be useful to you, since it was early draft just to experiment with the lsp4s library and connecting to OMC using stdin/stdout. It is probably better than nothing, but most probably you already have much more working code. Or don't you have any LSP server at all right now? If so, I can publish this early draft several days later.

Maybe OpenModelica/OMEdit#171 would be more interesting source of information and ideas even being written in C++...

@atrosinenko
Copy link

@thorade I ultimately managed to publish it, please excuse me for the delay: https://github.com/atrosinenko/om-lsp-draft. But it is quite ugly and mostly not working :) Published it "just in case".

@thorade
Copy link
Author

thorade commented Mar 26, 2019

Thank you anyway, might be helpful to someone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants