Skip to content

Conversation

@TomDevs
Copy link

@TomDevs TomDevs commented Nov 29, 2017

  • Fixed to work with IDEA 2016.1 and above
  • Fixed tests
  • Added setting to specify import block names

@TomDevs TomDevs changed the title fix compatibility with IDEA 2016.1+ fix compatibility with IDEA 2016.1 and above Nov 29, 2017
@sindilevich
Copy link

@TomDevs, thanks for updating the plugin to work with the latest versions of WebStorm. Will try it out, downloading from yours (https://github.com/TomDevs/needsmoredojo/tree/master/dist), since it looks like @cefolger does not support the repo anymore.

@asoltesz
Copy link

@TomDevs Many thanks for the update.

Copy link

@sindilevich sindilevich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @TomDevs! Was comparing your PR with #181 and found some differences, which you might think are necessary in your PR too.

}
}
return false;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also line#47 be changed to Collections.addAll(parameters, function.getParameterVariables());?

}

if(imports.getChildren().length == 0)
if(imports.getExpressions().length == 0)
Copy link

@sindilevich sindilevich Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of using getExpressions() over getChildren() here? #181 does not changed that, so am asking for general knowledge.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a problem that when adding an import (Ctrl+Shift+O, 2), the import was added in the wrong location, usually outside of the JavaScript import array. Using getExpressions() fixed this issue.

int sourceIndex = PsiUtil.getIndexInParent(defines[0]);
int destinationIndex = PsiUtil.getIndexInParent(defines[1]);
JSParameter[] parameterList = items.getFunction().getParameters();
JSParameter[] parameterList = items.getFunction().getParameterVariables();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also src/com/chrisfolger/needsmoredojo/core/amd/define/NearestAMDImportLocator.java still use the old getFunction().getParameters() in line 60 and line 123.

And src/com/chrisfolger/needsmoredojo/core/amd/importing/ImportUpdater.java still use the old getFunction().getParameters() in line 65 and line 74.

Copy link
Author

@TomDevs TomDevs Dec 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a lot of cases getParameters() and getParameterVariables() can be used to do the same things, so it shouldn't really matter which method is used; I changed the ones necessary to fix the test cases and get the plugin to a working state.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomDevs, thank you fro your reply. You may be right, replacing the minimum possible, but there was a problem reported here: #181 (comment) that was handled by replacing getFunction().getParameters() with getFunction().getParameterVariables(), as per 427bc53. That's why I wanted to point out these places to you to look closer at.

<id>com.chrisfolger.needsmoredojo</id>
<name>Needs More Dojo</name>
<version>0.7</version>
<version>0.8.1</version>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#181 suggests moving the file to resources/META-INF/plugin.xml and updating resources/META-INF/MANIFEST.MF.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this file location particularly matters, but if this becomes a problem I'll happily move it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants