eclipse-pdt / pdt

PHP Development Tools project (PDT)
https://eclipse.org/pdt
Eclipse Public License 2.0
188 stars 46 forks source link

Create Twig File Template Error #281

Open peregrinodeti opened 2 weeks ago

peregrinodeti commented 2 weeks ago

Describe the bug Create a Twig File Template with Eclipse Twig Plug-in throws an error if you try to create the file out of the src root folder in an Empty Composer Project.

Describe the eclipse environment Eclipse Version: 2024-06; PDT Version: PDT Profiler UI Plug-in 8.2.0.202311292129 org.eclipse.php.profiler; Plugins: Twig Editor Feature 2.3.0.202309270934 com.dubture.twig.feature.feature.group.

Describe your system

To Reproduce Steps to reproduce the behavior:

  1. Go to Eclipse Menu File -> New -> Empty Composer Project;
  2. Fill the Basic Composer Configuration, for example: Project Name: test; Vendor Name: Test; Type: project; Click on the Finish Button;
  3. Now that the project has been created, select it and go to Eclipse Menu File -> New -> Other -> Search for Wizard Twig template; Click on Next Button;
  4. Fill in the information about the new Twig template, for example: Source folder: test/src; File name: template.twig (or other name); Click the Finish Button. The Twig Template File was created with no problem;
  5. Now create a new folder in test project, select the project name, and then go to Eclipse Menu File -> New -> Folder;
  6. Fill the Folder name: views (for example);
  7. Repeat these steps:
    • Go to, Eclipse Menu File -> New -> Other -> Search for Wizard Twig template; Click on Next Button;
    • Fill the informations about New Twig Template, for example: Source folder: test/views; File name: template2.twig (or other name); Click on Finish Button. The Twig Template File is not created, and IDE throws a exception: Creation of element failed - Cannot invoke "org.eclipse.dltk.core.IScriptFolder.getSourceModule(string)" because the return value of "org.eclipse.dltk.ui.wizards.NewSourceModulePage.getScriptFolder()" is null.

Expected behavior Create the Twig File Template with no problem.

Screenshots Follow the screenshot about the case describe above:

twig_eclipse_error

Additional context Now if you create a simple PHP Project, in Eclipse Menu File -> New -> PHP Project. Create any folder inside this project and then create a Twig Template File in this folders, this problem will not occur. The scr root folder, a principle, is the origin of the problem. The Twig Wizard only works if you create the files and folders inside this root folder when the project is the kind of Empty Composer Project.