THM-MoTE / mope-server

Server process for Modelica | Editor
https://thm-mote.github.io//projects/mope
GNU General Public License v3.0
9 stars 0 forks source link

"Open Documentation" parses wrong class name #15

Open CSchoel opened 5 years ago

CSchoel commented 5 years ago

When trying to open the documentation for this package

package SHMContraction "modular and monolithic models of the human cardiac conduction system based on the PhD thesis of H. Seidel"
annotation(Documentation(info="<html>
  <p>Contains a modular version of the cardiac conduction system in the
  Seidel-Herzel-model (SHM)</p>
</html>"));
end SHMContraction;

Mo|E opens this URL in the browser

http://localhost:9001/mope/project/0/doc?class=%3C/html%3E%22));

which is not exactly helpful. ;)

The same is true for models within a package with varying line numbers from where the supposed class name is parsed.

njustus commented 5 years ago

Did you remember that the class name is taken from the cursor position inside of Atom? We don't parse anything when we open the documentation. Maybe your cursor was misplaced? It should work if the cursor's position is similar to these 2 examples:

package SHMContraction| "modular and monolithic models of the human cardiac conduction system based on the PhD thesis of H. Seidel"
annotation(Documentation(info="<html>
  <p>Contains a modular version of the cardiac conduction system in the
  Seidel-Herzel-model (SHM)</p>
</html>"));
end SHMContraction;

or even better somewhere in between the class name:

package SHMCont|raction "modular and monolithic models of the human cardiac conduction system based on the PhD thesis of H. Seidel"
annotation(Documentation(info="<html>
  <p>Contains a modular version of the cardiac conduction system in the
  Seidel-Herzel-model (SHM)</p>
</html>"));
end SHMContraction;
CSchoel commented 4 years ago

Having the cursor within the name of the component does fix the original issue, but this is unintuitive behavior. If there is only one class in the file, why should I need to have the cursor on the name of that file in order to open the documentation? Maybe we should have two separate commands: "Mope: Open Documentation" to open the documentation of the Package/Model defined in the current file. And "Mope: Open Documentation from Cursor" (or something similar) to open the documentation of the class that is currently selected.

And then, Mo|E still has major issues in getting the model name right:

CSchoel commented 4 years ago

This is also connected with #19 .