rokucommunity/vscode-brightscript-language

bsConst in launch.json does not affect component libraries

iBicha opened this issue · 8 comments

bsConst are being updated on the app manifest, but not component libraries

Hmm. Component libraries and the main project all flow through the same manifest transformation logic here: https://github.com/rokucommunity/roku-debug/blob/bb2146888261a7d2d21cdb17dc31e1715e72ae2a/src/managers/ProjectManager.ts#L291

Are you using a preprocessor or brighterscript somewhere by chance? Because brighterscript currently transpiled away all the false blocks. (We want to fix that eventually...)

Hmm. Component libraries and the main project all flow through the same manifest transformation logic here: https://github.com/rokucommunity/roku-debug/blob/bb2146888261a7d2d21cdb17dc31e1715e72ae2a/src/managers/ProjectManager.ts#L291

Are you using a preprocessor or brighterscript somewhere by chance? Because brighterscript currently transpiled away all the false blocks. (We want to fix that eventually...)

I'm using brighterscript, and the output of it contains all the false values.

Like after transpiling with bsc my manifest still has

bs_const=DEBUG=false;WEB_SERVER_BASIC_AUTH=false;DASH_THUMBNAILS=false;WEB_SOCKETS=true

Also, I don't see it looping through all manifests, or is a Project object created for each component library?

I wasn't talking about the manifest itself, i was talking about the code. So Something like this:

bs_const=some_true_value=true;some_false_value=false;

#if some_true_value
    'i get to stay
#end if
#if some_false_value
    'i get deleted
#end if 

will result in this output code:

#if some_true_value
    'i get to stay
#end if 

Got it, sorry for not being clear. No what's missing is the manifest of the component library is not updated according to the launch config

Got it, sorry for not being clear. No what's missing is the manifest of the component library is not updated according to the launch config

Ah, ok. Well then yeah, I guess there's a bug somewhere. Maybe vscode isn't sending the bsconst stuff up for complibs during launch.

Also, I don't see it looping through all manifests, or is a Project object created for each component library?

Yeah, we make one project for the main app, and a project for each complib.

To work around the issue, I was trying to modify the manifest in staging just before bsc starts transpiling.
Turns out bsc does not care about the manifest in the staging.

I ended up modifying the actual rootDir manifest right before bsc does work, and restoring it back later (plugin)

BrighterScript v1 recently introduced proper AST support for conditional compile statements being transpiled into the output (see rokucommunity/brighterscript#1149). So I'm going to close this issue, as it should eventually be fixed with v1 lands.