Code autocomplete does not recognize custom packages

Published by Nuparu00 on Thu, 07/19/2018 - 14:47
Status
Fixed
Type
Product/platform
MCreator/Windows
Priority
Normal
Issue description

It seems that custom packages are not still handled properly by the code editor as the code editor does not offer my sub-packages, classes, methods, and fields in my custom package, that has a root in the default package (so the package name is, for example, net.nuparu.sevendaystomine.util).
Ctrl + double click does not take me to the declaration of the class, method, etc...
Reformat the code and imports button does not import my classes and removes any type-import-on-demand declaration.
(Example, I call from a MCreator generated class a static method getLogger(), that is declared in a class Utils that is in a package with name net.nuparu.sevendaystomine.util . If I manually import the class by writing import net.nuparu.sevendaystomine.util.Utils; , it will keep it, however, if I use import net.nuparu.sevendaystomine.util.*; , it will just remove it.)

Trying the Reformat the code and imports button seems to sometimes remove some if not all of the imports.

EDIT: It seems to kinda work with "this" keyword.

Issue comments

We are constantly improving our code editor. I can confirm the observations you found.

We will improve this in the future, gradually, but will. Thank you for pointing out these issues.

Our current import organizer implementation is very limited and this is why this happens.

I have made some improvements to the code editor based on your reports. Summary from the changelog:

  • Jump to the declaration of the code editor is now package aware and can jump between custom Java packages
  • Jump to declaration now supports jumping to and between Java core source codes too
  • Autocomplete now loads custom classes from all packages available from the built version of the mod
  • Improved import organizer to be aware of its package, support custom Java objects and keep unknown wildcard imports

There have been some other improvements to the code editor too, check the https://mcreator.net/changelog for the complete list.

I am closing this ticket and all these bug reports will be fixed in 1.8.0.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.