Closed mkruselj closed 1 year ago
Add option to include multiple save_compile_source
Jack already said that, but just to reinforce (and paste from #275) please add the possibility to add multiple save_compile_source this way we can have the compiled going into the /Resources/scripts folder AND a local copy inside the sources folder, to avoid having to copy the compiled code every time we need to check something.
also have the option to preserve the spaces / tabs. Quite useful if you need to read the compiled code.
Another one, something like:
{ #pragma initcb_ksp ./my_main_file.ksp }
this pragma would go at the top of all ksp files pointing to the file with the ICB
this way the user can press compile from anywhere and get the code compiled correctly, even if more than one project is open in that sublime window. There would be no need to find the tab with the main file (with the ICB) to press compile.
example:
main.ksp
on init
import "my_vars.ksp"
import "declarations.ksp"
end on
my_vars.ksp
{ pragma initcb_ksp ./main.ksp }
declare a := 0
declare b := 1
declarations.ksp
{ pragma initcb_ksp ./main.ksp }
declare ui_slider slider1 (1,100)
declare ui_slider slider2 (1,100)
to avoid having to copy the compiled code every time we need to check something.
You do know you can use symbolic links for this, right? 🙂
Regarding your "initcb_ksp" pragma, it's a good idea, but your example is not what I would consider good design. This pragma should ONLY be found in the top-level file that you would usually press F5 on to compile the whole thing with all its imports. It makes no sense to do this in each and every import towards that one main file, that's just so very bad.
I would also name that pragma something like { #pragma target_for_compiling }
just to make it very clear. There is no need at all to have a path in this pragma - it is just there to mark the .ksp file as the one to compile, even if it's not a focused tab.
I do use sym links already, it would be cool to not have to set them up for every project.
On the compile from any of the external KSP files topic, you mean that having the pragma in the main file would indicate that the plugin would read all the import statements of the main and external files and keep a cache to know if the user presses compile from any of the appointed files? Sounds like it could work and yes, prevents the user from having to put a pragma line on every file.
On the compile from any of the external KSP files topic, you mean that having the pragma in the main file would indicate that the plugin would read all the import statements of the main and external files and keep a cache to know if the user presses compile from any of the appointed files? Sounds like it could work and yes, prevents the user from having to put a pragma line on every file.
Yes, that is exactly my point. It's simply a way better design, that's also easier to use. Except there's no need to have any cache. What we would just do is loop through all open views, look for that pragma line in each, if it's there, run compile on that view. If you did a single compile (F5 or Cmd+K) it would stop at the first result it hit. If you did a multi compile (Shift+F5) it would continue until all views have been scanned through.
We should be able to override the SublimeKSP settings with these pragma directives:
If
optimize_compiled_code
was set to true butextra_syntax_checks
was not set to true, or the SublimeKSP native option is false, compiler should error out saying that extra syntax checks must be enabled for that option to work.