mdenet / platformtools

Education platform tool functions.
Eclipse Public License 2.0
0 stars 3 forks source link

Xtext project files created incorrectly #55

Closed barnettwilliam closed 6 months ago

barnettwilliam commented 8 months ago

The paths the Xtext tool function uses when re-creating project files assumes that the baseName is a substring of languageName

https://github.com/mdenet/platformtools/blob/6d6644a4ece40940bcd2fb689144a3cf9ac49e9a/services/com.mde-network.ep.toolfunctions.xtext/src/main/java/com/mdenetnetwork/ep/toolfunctions/xtext/XtextTool.java#L73-L76

This doesn't have to be the case and if it isn't, the recreated file contains the the full langauageName including java the package.

pathName being a substring of languageName means the example Xtext project would contain duplicated names in the Xtext project package e.g. uk.ac.kcl.inf.mdd1.turtles.Turtles

szschaler commented 8 months ago

Can you provide an example where this becomes a problem? What is the preferred resolution?

barnettwilliam commented 8 months ago

If parameters given in the Xtext action
"languageName": "uk.ac.kcl.inf.mdd6b.Turtles", "baseName": "uk.ac.kcl.inf.mdd6b.turtles",

The recreated scope would be ../scoping/uk.ac.kcl.inf.mdd6b.TurtlesScopeProvider.xtend

Instead the last segment of languageName should be used as shortName which in this example it would be Turtles

szschaler commented 8 months ago

So the solution would be to change

 final String shortName = languageName.replace(baseName + ".", ""); 

to the more general

 final String shortName = languageName.substring(languageName.lastIndexOf(".") + 1);

?

barnettwilliam commented 8 months ago

Yes