neverwinter.nim icon indicating copy to clipboard operation
neverwinter.nim copied to clipboard

nwn_script_comp: Cannot compile an include file on its own

Open PhilippeChab opened this issue 1 year ago • 2 comments

Description

This feature was added in the nwnsc and was useful for the language server. It would be neat to have it available in the nwn_script_comp as well.

PhilippeChab avatar Oct 22 '23 17:10 PhilippeChab

I can see how it could be useful, but also I would definitely want the "no main function" to be an error by default. This could be a flag to the nim frontend, to just generate a temporary file like

#include "actual_file"
void main() {}

and compile that, discarding the result.

Would you need this in burst mode too, or just when compiling a single include?

mtijanic avatar Oct 22 '23 18:10 mtijanic

It is actually what I would have done on my end if it was not going to be supported.

A flag parameter would be perfect.

The most complex case I need to support is the following:

  • /constants/
    • /constants/const_colors.nss
  • /libs/
    • /libs/inc_database.nss
  • /cli/
    • /cli/const_cli.nss

With const_cli.nss being an include:

#include "const_colors"
#include "inc_database"

...

~I would need to be able to compile all 3 includes at once.~

EDIT: With the --dirs flag and children includes loaded in resman, I only need this for a single include.

PhilippeChab avatar Oct 23 '23 16:10 PhilippeChab