Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Open declaration (f3) in the (java)script editor

Hi,

I have this line:

forms.test.controller;

now i go with my cursor on test and press f3 to open test.
But what i get is first a dialog with a selection that i have to make with  "test,test2,testx";
This is because it goes throug:

That goes through SourceModel.codeSelect()

and that in the end will result in a parse of:

forms.test

and that will result in duplicates. But what i really select is a single item, so for a user this is weird (for code completion this is correct)

any takers where i can fix that correctly?

For example the hover also has that same problem

But i fixed that in AbstractScriptEditorTextHover  (didnt commit it yet)

if (nResults > 1) {
                    ArrayList al = new ArrayList();
                    for (int i = 0; i < result.length; i++) {
                        String elementName = result[i].getElementName();
                        if (content.equals(elementName)) {
                            // exact match is found add that to the list to use.
                            al.add(result[i]);
                        }
                    }
                    if (al.size() > 0) {
                        result = new IModelElement[al.size()];
                        result = (IModelElement[]) al.toArray(result);
                    }

so if the result is more then 1 i look if there is an exact hit. If it is i only show that one (because very likely that is what a user wants)

But i guess somehow i should able to say that a bit earlier? So in the Openable:
protected IModelElement[] codeSelect(
            org.eclipse.dltk.compiler.env.ISourceModule cu, int offset,
            int length, WorkingCopyOwner owner) throws ModelException {

or the call to the engine:

    IModelElement[] elements = engine.select(cu, offset, offset + length
                - 1);

that i really want the exact match?

Do other languages have a different implementation of engine.select??

johan


Back to the top