getting Code-completion to work

Hi all,

I'm in some trouble while writing a DOM Model, but I'm simply not able to find out why there's no code-completion.

Here's a sample of a Model class:

@Convert(MyConverter.class)
public interface MyElement extends GenericDomValue<String> {
    @XmlAttribute
    String getFoo();

    @XmlAttribute
    String getBar();
}


And here's the converter:

public class MyConverter extends ResolvingConverter {

    @NotNull
    @Override
    public Collection getVariants(ConvertContext context) {
            List result = new LinkedList();
            result.add("this");
            result.add("class");
            return result;
    }

    @Override
    public String fromString(@Nullable String s, ConvertContext context) {
        return getVariants(context).contains(s) ? s : null;
    }

    @Override
    public String toString(@Nullable String s, ConvertContext context) {
        return s;
    }
}



I'm observing that all methods are called as expected, but am wondering what goes wrong here, as I do not get any completion proposals.

Could somebody please have a look!?

Best regards,


Florian

3 comments
Comment actions Permalink

This doesn't look like a well-formed IDEA DOM interface. Could you post
an XML sample of a code which should be completed?

0
Comment actions Permalink

Hi Peter,

in fact it's an example (and somehow I've managed to miss out some generics in my converter, but just in my posting here).
The original one is a bit lengthy, so I've sent the MyElement example.

In the end I want to have some completion on a DOM elements' text.

To keep up with the example, I want to complete an element of the form:

<myExample foo="something" bar="someOtherThing">textToBeCompleted</myExample>


I've got model classes with enums (NamedEnum) and all works fine there.
In the end I think it will be a layer-8 problem (myself), so I hope that you can give me some hints where to look at.

Best regards,

Florian

0
Comment actions Permalink

Looks like it should work. The fastest troubleshooting way I can suggest
to you is to debug it by attaching IDEA Community Edition sources from
'maia' branch and setting a breakpoint in getVariants(). You need to
ensure that a DomVariant with a correct string is created, the string is
correctly matched against a PrefixMatcher in a CompletionContributor,
and no other contributor prevents your variant from being passed through
to Lookup.

0

Please sign in to leave a comment.