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

Expose DFHack C++ modules #4

Open
vallode opened this issue Apr 21, 2024 · 2 comments
Open

Expose DFHack C++ modules #4

vallode opened this issue Apr 21, 2024 · 2 comments

Comments

@vallode
Copy link
Owner

vallode commented Apr 21, 2024

Placeholder issue to gather my thoughts on how we should go about exposing the C++ modules to Lua language server.

@vallode
Copy link
Owner Author

vallode commented Apr 23, 2024

Some basic generation is taking place already, mostly via searching the LuaApi.cpp file in dfhack and parsing basic function signatures. This covers a lot of ground but misses some more abstract lua state manipulation functions that would at least be nice to expose a return type of.

@vallode
Copy link
Owner Author

vallode commented Jun 2, 2024

On the DFHack Discord there was some discussion about adding type comments (akin to JSDoc) to the relevant cpp files and read that in the type generation. The example Thyrus was quite neat, slightly modifying it gives an example of a c++ function like so:

/*lua
@param base dfhack.pen|dfhack.color
@param pen_or_fg? dfhack.pen|dfhack.color
@param bg? dfhack.color
@param bold? boolean
@return dfhack.pen
*/
static int dfhack_pen_parse(lua_State *L) {}

We can do some simple sanity checking for this (correct @ tag, non reserved name, maybe even checking if the type exists) and output that to the relevant files instead.

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

1 participant