foam-language-server
foam-language-server copied to clipboard
banana trick
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
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:
- Dictionary keywords do not necessary match class names. I wish everything was like
dynamicFvMesh staticFvMesh;
. This would have been far easier. - Auto-completing the RTS (RunTime-Selectable) models puts us in an immediate need to also complete the specific settings associated with each model.
- This is usually dependent on the target OpenFOAM version, so not so maintainable.
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