Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 29467

Summary: Ant Code Completion
Product: projects Reporter: shemnon <shemnon>
Component: AntAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: issues
Version: 3.x   
Target Milestone: 3.x   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: ENHANCEMENT Exception Report:
Bug Depends on: 34515, 37113    
Bug Blocks:    

Description shemnon 2002-12-11 15:30:39 UTC
Another productivity issue that develoeprs woud
appreciate is code completion for Ant projects,
much like has been done for 
XSL in bug #20421
(http://www.netbeans.org/issues/show_bug.cgi?id=20421).
Comment 1 Jesse Glick 2002-12-11 16:55:47 UTC
I believe someone was already working on a "scenario" XML plug-in for
Ant scripts?
Comment 2 _ pkuzel 2002-12-12 13:48:04 UTC
I have prototype/skeletal implementation of Ant grammar bridge. I'll
commit first shareable code soon under
nb_all/ant/grammar.
Comment 3 Jesse Glick 2002-12-20 20:23:56 UTC
It's there, it works. I have made some fixes to it, will make some
more. Do you think it is reasonable to put this on the Dev Alpha Daily
update server? Just how unstable is the XML code completion API
("scenarios" I guess)?
Comment 4 John Jullion-ceccarelli 2003-01-02 10:04:40 UTC
A few questions about this:

So this is for code completion for tags in an Ant script? 
Which tags would code completion be available  for (standard Ant task
names?) 
What needs to be configured for this to work? (Ant docs module
installed?) 
When would this be implemented for? (4.0?)

Thanks.
Comment 5 Jesse Glick 2003-01-06 19:59:21 UTC
"So this is for code completion for tags in an Ant script?" - right.

"Which tags would code completion be available for (standard Ant task
names?)" - currently supports standard Ant tasks and types, their
attributes, and subelements (only direct subelements tho, and not
their attributes), and a couple special elements like <description>.
To do: custom-defined tasks and types that have been used at least
once (as with the New... submenus in the Explorer), and full support
for all recursive subelements and their attributes.

"What needs to be configured for this to work? (Ant docs module
installed?)" - no need for the docs module, just need to add this one
and it starts working. Depends on some XML modules.

"When would this be implemented for? (4.0?)" - I suppose so; stability
of the XML module APIs it uses is TBD.
Comment 6 Jesse Glick 2003-01-07 22:46:54 UTC
Custom tasks/types now supported.

Forgot another to-do: better type-specific completion of attr values,
not just names. For example, you type:

<target name="foo">
    <copy fail
              ^- cursor here

and press Ctrl-Space and complete to

<target name="foo">
    <copy failonerror="
                       ^- cursor here

Fine, but now Ctrl-Space does nothing. Should offer "true" and
"false". Ditto for any attribute whose possible values are fixed - all
booleans, EnumeratedValue types, maybe others.

Cool would be: completion of target names in depends, antcall, etc.;
completion of property names after "${" (if they were already defined
elsewhere in the script); completion of property names in if/unless;
completion of ids in refid=" (if already defined elsewhere in the
script); etc.
Comment 7 Jesse Glick 2003-01-11 02:04:55 UTC
Have now implemented fully recursive support for nested elements etc.
Rather than seeing that the containing element is called "classpath",
it actually checks if this is a <classpath> inside <project> or inside
<target> or inside <xmlcatalog> etc., and can behave appropriately.
Benefits:

- completion of subelements and attributes in deeply nested structures

- understands context, i.e. if you have:

public class A extends Task {
    public void setFoo(String x) {}
}
public class B extends Task {
    public void addA(BA x) {}
    public class BA {
        public void setBar(String x) {}
    }
}

and a project

<project default="all">
    <target name="all">
        <taskdef name="a" classname="A" classpath="..."/>
        <taskdef name="b" classname="B" classpath="..."/>
        <a foo="x"/>
        <b>
            <a bar="y"/>
        </b>
    </target>
</project>

then completion should know that the first <a> can have only the 'foo'
attr but the second can have only the 'bar' attr. This kind of
precision is not possible to capture with a DTD, by the way, so e.g.
Emacs' PSGML mode with the DTD from <antstructure> will goof on the
above example.
Comment 8 Jesse Glick 2003-01-11 02:22:48 UTC
The module seems pretty useful now, though it is still using an
unstable API so should be considered experimental. I put in a hook to
have it added to the NetBeans Alpha update server in the Nightly
Builds section, so anyone interested in trying it should be able to
get it easily.
Comment 9 Jesse Glick 2003-11-09 16:06:57 UTC
Several kinds of completion on attributes working now.
Comment 10 Jesse Glick 2003-12-22 13:50:38 UTC
Let's call it FIXED for now - particular enhancement requests can be
filed separately.
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo