FoamScience / foam-language-server

A language server for OpenFOAM case files
27 stars 0 forks source link

banana trick #15

Open HenningScheufler opened 10 months ago

HenningScheufler commented 10 months ago

Very interesting project and it would significantly lower OpenFOAM learning curve.

Regarding the banana trick i parsed the headers of the runtime selectable functions and displayed them in markdown. Another approach would be to use doxygen. Then you would be able to show the documentation a longside the possible solutions:

The data should be available in ofdata as a json:

https://github.com/HenningScheufler/ofdata https://github.com/HenningScheufler/pybFoam

FoamScience commented 10 months ago

Glad this project is gaining interest. I didn't have time to advance on this front yet but I think I'll have significant improvements in the near future.

I have been slowly converging towards an automatic way to generate "dictionary schemas" for OpenFOAM classes. By that I mean "skeletons for valid dictionary configuration" for any class that needs to read a dictionary.

As for parsing headers to figure out runtime selection relationships, this might be a valid option. It will at least solve the documentation problem. I actually had a similar solution (by looking at symbols from actual shared lib files) but that obviously had its drawbacks so It was dropped:

So, my initial thought was to provide a generic way to build "boilerplate dictionary content" for RTS classes. This is possible entirely at compile-time (0-overhead on simulation time) and requires no refactoring of OpenFOAM code base, well, maybe a little. This is still way too young to make it into this project but you can try it out here: FoamScience/openfoam-reflections

Let's leave this issue open to track work in this field