Closed ryanzec closed 2 months ago
Hello! Thank you for your interest.
func _ready() ->void: #~if OS.is_debug_build() var c = 0
Currently, directives must start at the beginning of the line, like the C/C++ preprocessor. I can add indentation support if you wish.
func _ready() -> void:
#~if OS.is_debug_build()
var c = 0
Note that the plugin also tries to resolve regular if
/elif
/else
statements (albeit less reliably). I supposed that directives would be used primarily outside function bodies, since GDScript does not support if
/elif
/else
outside functions.
func _ready() -> void:
if OS.is_debug_build():
var c = 0
Thanks, it does seem like both your suggestions work in this case. I think I only tried the directive version as initially I could not get it working with a normal if
(but that was because I was unaware on how to export a project without debug which I have since figured out).
I am relatively indifferent to the formatting of the preprocessor, I only favor allow leading whitespace as it just make the code slightly cleaner but I will close this since the expected patterns do work and you can decide if it is worth allowing leading spacing since it is not really that big of a deal.
Thank you for building and maintaining this plugin.
So I have the follow code:
but when I export the project with the
Export With Debug
unchecked and unpack the pck file, the code looks like this:I am not sure why only comments are bring stripped out. I would expect the conditional block to be stripped. I did not change any of the setting in the export dialog and I restarted the editor after enabling the plugin to make sure that was good.
I also tried using
#~if OS.has_feature("editor")
(which I assume should be stripped regardless of it being in debug mode) and got the same result.