flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Tynjala <joshtynj...@gmail.com>
Subject Re: [FlexJS][VSCode-NextGenAS] Getting to work with VSCode
Date Tue, 27 Sep 2016 17:36:03 GMT
Awesome. Thanks for the feedback, Carlos!

In one of the browser debuggers (either Chrome or Firefox), I couldn't get
a breakpoint to work in the constructor of the main class. Just like you
describe. Strangely, the main class constructor worked in the other
browser's debugger, and constructors from other classes were fine in both.
Since I saw that you tried using VSCode's Chrome debugging extension, it
must have been Firefox that worked properly with the main class constructor.

I don't really know why this happens. I kind of wonder if the source map
isn't fully loaded/parsed yet when the code starts running in Chrome. By
the time the click listener is called, everything is finished initializing,
I guess. That seemed like the most likely explanation to me.

I think you can tell the debugger to pause immediately after starting, so
you might give that a try. If it works, let me know and I can make a note
of it somewhere.

1. This is correct. For the initial release, I focused on ActionScript
only. MXML probably isn't trivial, but hopefully the most challenging parts
of integrating with the compiler are already done, so it should be easier.

2. Only the main class for your app is all that's required in the "files"
field of asconfig.json. All dependencies will be detected by the compiler.
I just updated the description in the wiki to try to make that a little
more clear. I'll get the description in the JSON schema updated too.

A little background. In most cases, people pass only one class into mxmlc,
but technically, it supports passing in multiple classes, with the final
one being considered the entry point. I think other classes that are passed
in are simply included, even if they aren't referenced. Probably so that
they can be found by reflection or something.

VSCode supports a similar tsconfig.json for TypeScript, and it also allows
multiple files to be passed in (but it resolves dependencies too). To me,
it made sense to allow multiple files, even if it isn't commonly used. I
think this just needs clear documentation so that people understand that
they don't need to include every class that they use. Just the main one,
most of the time.

3. Which libraries from the SDK are included depends on which "config"
value you set in your asconfig.json. You probably want "config": "flex",
but there's one gotcha to watch out for. By default, both the extension and
asconfigc consider "config": "flex" to be a SWF project for Flash Player.
If you want to transpile to JS, and also use the FlexJS components, you'll
also need to specify the "js-output-type" compiler option (the value should
be "flexjs", I think?). This isn't ideal, but it's the best I could come up
with because FlexJS doesn't have separate config files for JS and Flash
Player (though, maybe it should...). I couldn't find a good way to do the
opposite and make JS the default. I guess a new top-level field in
asconfig.json could specify this, but I'm trying to keep extra
configuration in asconfig.json that isn't a real compiler option to a

4. I'm not a Maven person. I would expect that you could set up Maven to
run an executable like asconfigc. However, I suspect that's not considered
the Maven way. Some kind of Maven plugin to parse asconfig.json and pass
the right arguments to the compiler (which is basically how asconfigc
works) might be closer to how a Maven person would expect this to work.

asconfig.json follows the VSCode way of doing things. There is
tsconfig.json for TypeScript and jsconfig.json for JavaScript. I wanted to
follow the same pattern, if possible. I tried using the little-known trick
where mxmlc will try to load a -config.xml file if it matches the main
class file name (so for Main.as, it would try to load Main-config.xml, if
it exists), but it couldn't configure everything.

- Josh

On Tue, Sep 27, 2016 at 9:28 AM, Carlos Rovira <carlosrovira@apache.org>

> Hi Josh,
> at last I could get all up and running with Visual Code and your @NextGenAS
> extension, building and debgugging in Chrome. Pretty Amazing work! :)
> (just one thing, the break point worked in a click function, but not in a
> line of the main Main.as function, maybe source-maps doesn't work if the
> breakpoint is in the constructor?)
> Right now I'm figuring where to go from here:
> 1.- I thing I read somewhere that MXML is not supported yet in VSCODE, is
> this right?
> 2.- I must list all as files in asconfig.json? or we could give is a folder
> (i.e: "src") ?
> 3.- I'm trying to make some basic import from org.apache but VSCode not
> recognize them:
> package com.carlosrovira
> {
>     import org.apache.flex.events.Event;         <-----------------this 2
> imports are not found
> import org.apache.flex.events.EventDispatcher;
> public class Component extends EventDispatcher.   <---and this extends
> fails
> {
> public function Component()
> {
> }
> }
> }
> 3.- I build flexJS with maven, and my plan is to use a pom.xml, but there's
> a asconfig.json as well....maybe is too cumbersome to have 2 config
> files....could this be integrated both?
> (maybe there's some maven extension in vscode? that make it easy to run and
> build...I'm too new to vscode yet! :))
> So far, as I said, amazing work! I think VSCode is now the best choice for
> FlexJS development, not only for the fast progress, but for the
> possibilities behind in few months.
> Hope you continue get donations to your work on Patreon.
> Best,
> --
> Carlos Rovira
> http://about.me/carlosrovira

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message