Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Autocompletion and nested configuration tags

Right now m2e supports contextual completion of mojo parameter names. It is very convenient.
Sometimes the parameters are not simple strings but are strongly typed. Maven Mojo API has very definte semantics how Mojo parameters are mapped  [1], [2], so this could be done in a fully deterministic way.

Consider this example:

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <webResources>_

At this point the autocomlete should suggest "webResource" per convention for multi valued parameters

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <webResources>
      <webResource>_

AbstractWarMojo.webResources is typed as array of Resource [3] so org.apache.maven.plugins.model.Resource class is introspected to determine what are possible further completions.

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <webResources>
      <webResource>
       <directory>${project.basedir}/_

Resource.directory is typed as File [4] so the m2e can start suggesting files and directories denoted by the pathname resulting from evaluation of the _expression_ between last > and cursor.
In case that File typed parameter does not evaluate to an existing file/directory after the tag is closed, a warning marker could be set on the POM file.

The top level parameter completion is very useful as it is, but I'd love to see full completion in a future release of m2e

cheers,
Rafał

[1] http://maven.apache.org/developers/mojo-api-specification.html
[2] http://maven.apache.org/guides/plugin/guide-java-plugin-development.html#Parameters
[3] http://maven.apache.org/plugins/maven-war-plugin/xref/org/apache/maven/plugin/war/AbstractWarMojo.html#134
[4] http://svn.apache.org/viewvc/maven/maven-3/tags/maven-3.0.3/maven-model/src/main/mdo/maven.mdo?revision=1075437&view=markup line 2166

W dniu 2011-07-11 16:08, Matthew Piggott pisze:
I may be mistaken, but I believe the elements inside configuration can be plugin specific so it isn't practical to add contextual completion.

Matthew

On 10 July 2011 13:40, Sebastian Otaegui <feniix@xxxxxxxxx> wrote:
Hello, 

When using autocompletion in a plugin after I enter the <configuration></configuration> tag it seems the rest of the tag "do not have contextual completion".

This is:

I enter this config 

...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
</archive>
</configuration>
</plugin>

Inside <archive> it prompts me options to add (for example) <finalName> which is not a valid tag inside <archive>

Any plans to fix that behavior?

Regards
--
Those who do not understand Unix are condemned to reinvent it, poorly.
Any sufficiently recent Microsoft OS contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Unix.

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users




_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users


Back to the top