Closed Harbs closed 1 year ago
I tried to get this working a while back, but, unfortunately, I couldn't figure it out.
I guess my assumption was right...
Maybe a command to toggle the order of targets in the asconfigc file would be a decent workaround?
That way you could toggle the "main" target while working in a specific block to get code assist without going to the asconfigc file and changing it manually.
@Harbs
I took a look at this one today. I've figured out how I can force COMPILE::SWF and COMPILE::JS both to be true when using the compiler for code intelligence in Visual Studio Code. Completion, hover, and other features seem to be working correctly in both blocks now.
There is one issue. If the same variable name is defined separately in both COMPILE::SWF and COMPILE::JS in the same function, but both variables have a different type, you'll now get a compiler error in Visual Studio Code that you wouldn't get when compiling from the command line.
For one example, see the layout() function in org.apache.royale.html.beads.layouts.HorizontalLayout. The contentView variable is typed as ILayoutView in COMPILE::SWF and it's typed as IParentIUIBase in COMPILE::JS. I'm sure that there are many more.
If I'm to commit this change, you're probably going to need to make a ton of changes in the Royale framework to clear up these new conflicts. I think it's the right change to make for the user experience in Visual Studio Code, but I'd like to know what you and others on the Royale team think too.
Let me make sure I have this straight:
This is an issue only within a single function. If there are two separate functions:
COMPILE::SWF
override public function layout():Boolean
{
// some code
}
COMPILE::JS
override public function layout():Boolean
{
// some code
}
Rather than:
override public function layout():Boolean
{
COMPILE::SWF
{
// some code
}
COMPILE::JS
{
// some code
}
}
It will work. Right?
Additionally: If there's only SWF or JSRoyale specified in the asconfig file it will also work. Right?
I completely forgot that you could create separate functions with conditional compilation... I'll need to try it out to be sure, but separate functions might not work at all with this solution because they'll conflict with each other. I may be going back to the drawing board on this one.
To be clear, I was actually suggesting that you'd simply rename the variables in the same function instead of splitting it into two functions. Both options need to work for me to commit this change, but I don't think having two separate functions will work, unfortunately.
It looks to me like the first target in the list of
targets
is used for code intelligence.This means that if you have:
You get code intelligence for COMPILE::JS blocks but not COMPILE::SWF blocks.
If you have:
You get code intelligence for COMPILE::SWF blocks but not COMPILE::JS blocks.
Ideally, it would be best if the correct blocks would be associated with their targets. I assume this is hard, but it would be VERY useful.