I dug in and figured things out by trial and error recently, and I think I
ended up exactly where Alex described in regards to the completion engine.

createInvisibleCompilationUnit() is defined on FlexProject (or maybe a
superclass). This will create a compilation unit for a specific file (and
any files that depend on it). A compilation unit contains definitions for
classes/interfaces/functions/etc. Pass in the main class for an application
project, and that should pull in everything.

getCompilationUnits() is also defined on the project. This returns a
collection of all compilation units used by the project after you call
createInvisibleCompilationUnit() for the main class.

The following call will give you all of the public definitions that are in
a package block in a compilation unit:

Collection<IDefinition> definitions =
compilationUnit.getFileScopeRequest().get().getExternallyVisibleDefinitions()

You could use that to build a list of classes and interfaces. Loop through
all of the compilation units and grab anything that's instanceof
ITypeDefinition.

For member access completion, you need to get the scope from a type
definition:

TypeScope typeScope = (TypeScope) typeDefinition.getContainedScope();

Then call this function:

typeScope.getAllPropertiesForMemberAccess();

I'm about to open source an ActionScript plugin for a text editor. You'll
be able to look at my real code at that point, but hopefully these tips can
give you a headstart.

- Josh


On Thu, Sep 8, 2016 at 10:25 PM, Alex Harui <aha...@adobe.com> wrote:

>
>
> On 9/8/16, 9:56 PM, "santanu4ver" <santanu4...@gmail.com> wrote:
>
> >Hi Alex,
> >
> >I was looking into the Falcon description page here:
> >https://cwiki.apache.org/confluence/display/FLEX/Falcon+Overview which
> >confirms your opinion/suggestion on Falcon's code to use for
> >code-completion
> >to an IDE:
> >
> >
> >cwiki.apache.org wrote
> >> It should be useful as a code-intelligence engine and incremental
> >>compiler
> >> for an integrated development environment, and not just as a
> >>command-line
> >> compiler.
> >
> >As a complete beginner to understand Falcon, can you give us or point us
> >to
> >some more details on this? We would like to know what is Falcon's AST
> >codes,
> >where we can found this? If anyway we able to port the codes to an ANE,
> >can
> >you give suggestion how it should act to an IDE's code, how an IDE should
> >communicate to it to extract necessary code completion hints.
>
> Read the Architecture section of that wiki page.  It may not make a lot of
> sense right now, but a goal is for you to eventually understand it.
>
> I haven't worked with how Falcon was used for code-completion in Flash
> Builder, but you may not need to understand the AST portion of Falcon at
> all.  I think all you really need to know about is the Workspace,
> FlexProject, CompilerProblems, Definitions, and InvisibleCompilationUnit.
>
> I haven't worked with InvisibleCompilationUnit, but I believe it is how
> you send a file of text to be compiled without actually saving it to a
> file.  The compilation generates not just an AST, but also a set of
> CompilerProblems and Definitions.
>
> HTH,
> -Alex
>
>

Reply via email to