pulse00 / Symfony-2-Eclipse-Plugin

Symfony eclipse plugin.
symfony.dubture.com
MIT License
215 stars 48 forks source link

Code assist doesn't work #39

Closed daum closed 13 years ago

daum commented 13 years ago

After looking at all the installation guide, making sure the PHP source includes are correct, the symfony builder is enabled I am still having no code assist. I noticed when booting up Eclipse (Eclipse IDE for JavaScript Web Developers. Version: Indigo Release, Build id: 20110615-0604) that the DLTK indexing has an exception.

I installed the latest nightly build that was available from the site 0-pdt-Update-N201003190915, the one linked from the wiki 404s now(as I assume it is an old nightly build). Below is the exception:

Exception in thread "DLTK indexing" java.lang.NoSuchFieldError: sourceModule at org.eclipse.symfony.core.index.SymfonyIndexingVisitorExtension.visit(SymfonyIndexingVisitorExtension.java:138) at org.eclipse.php.internal.core.index.PhpIndexingVisitor.visit(PhpIndexingVisitor.java:708) at org.eclipse.php.internal.core.compiler.ast.nodes.ExpressionStatement.traverse(ExpressionStatement.java:42) at org.eclipse.dltk.ast.statements.Block.traverse(Block.java:43) at org.eclipse.php.internal.core.compiler.ast.nodes.IfStatement.traverse(IfStatement.java:55) at org.eclipse.dltk.ast.statements.Block.traverse(Block.java:43) at org.eclipse.dltk.ast.declarations.MethodDeclaration.traverseChildNodes(MethodDeclaration.java:97) at org.eclipse.dltk.ast.declarations.MethodDeclaration.traverse(MethodDeclaration.java:71) at org.eclipse.dltk.ast.statements.Block.traverse(Block.java:43) at org.eclipse.dltk.ast.declarations.TypeDeclaration.traverse(TypeDeclaration.java:158) at org.eclipse.dltk.ast.statements.Block.traverse(Block.java:43) at org.eclipse.dltk.ast.declarations.TypeDeclaration.traverse(TypeDeclaration.java:158) at org.eclipse.dltk.ast.statements.Block.traverse(Block.java:43) at org.eclipse.dltk.ast.declarations.ModuleDeclaration.traverse(ModuleDeclaration.java:71) at org.eclipse.php.internal.core.index.PhpIndexingParser.parseSourceModule(PhpIndexingParser.java:30) at org.eclipse.symfony.core.index.SymfonyIndexingParser.parseSourceModule(SymfonyIndexingParser.java:28) at org.eclipse.dltk.core.index2.AbstractIndexer.indexDocument(AbstractIndexer.java:45) at org.eclipse.dltk.internal.core.index.sql.SqlIndexer.indexDocument(SqlIndexer.java:143) at org.eclipse.dltk.internal.core.index2.SourceModulesRequest.run(SourceModulesRequest.java:78) at org.eclipse.dltk.core.search.indexing.AbstractJob.execute(AbstractJob.java:76) at org.eclipse.dltk.internal.core.search.processing.JobManager.run(JobManager.java:467) at java.lang.Thread.run(Thread.java:662)

pulse00 commented 13 years ago

i think you don't have the correct PDT version installed. sourceModule is exactly the field which has been added to the PhpIndexingVisitor class - which is needed by the Symfony plugin and was not available in previous versions of PDT.

Can you check the version of PDT by going to "About Eclipse SDK -> Installation Details"? There should be an entry named "PHP Development Tools" with the exact version of PDT.

The one i'm running in my test eclipse installation is 3.0.0.v201107240913-77--7C91A5Ad78NMcpUijVVg5skX. Your timestamp in the version number should be >= 20110724.

Btw. thanks for pointing out the dead link in the installation instructions. This is fixed now.

daum commented 13 years ago

Ok got the proper latest update however now am getting as soon as on the hello.html.twig template from the standard edition the following exception as soon as i do {%...

java.lang.NullPointerException at org.eclipse.twig.core.documentModel.TwigDOMModelParser.computeNestedTag(TwigDOMModelParser.java:90) at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertNestedTag(XMLModelParser.java:1226) at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStructuredDocumentRegion(XMLModelParser.java:1532) at org.eclipse.wst.xml.core.internal.document.XMLModelParser.changeStructuredDocumentRegion(XMLModelParser.java:550) at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceRegions(XMLModelParser.java:2317) at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.regionsReplaced(DOMModelImpl.java:846) at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:571) at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1189) at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1968) at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423) at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408) at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1) at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149) at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replaceText(JobSafeStructuredDocument.java:144) at org.eclipse.wst.sse.ui.internal.StructuredDocumentToTextAdapter.replaceTextRange(StructuredDocumentToTextAdapter.java:1187) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7180) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5911) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5941) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5635) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267) at org.eclipse.swt.widgets.Widget.sendIMKeyEvent(Widget.java:1344) at org.eclipse.swt.widgets.Control.gtk_commit(Control.java:2840) at org.eclipse.swt.widgets.Canvas.gtk_commit(Canvas.java:160) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1733) at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408) at org.eclipse.swt.internal.gtk.OS._gtk_im_context_filter_keypress(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_im_context_filter_keypress(OS.java:7793) at org.eclipse.swt.widgets.Control.filterKey(Control.java:2250) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3012) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743) at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408) at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8394) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2258) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

Here is mine: PHP Development Tools (PDT) All-In-One SDK 3.0.0.v201107290920-77--7C91A5Ad78NMcuZikTSgsskf org.eclipse.php.all.feature.group Eclipse.org

daum commented 13 years ago

Need anything else to help with the debugging?

pulse00 commented 13 years ago

nope, i'm just quite busy atm. i'll deploy a fix for this issue this weekend.

pulse00 commented 13 years ago

could you paste the twig template and the exact position at which you get the above exception?

daum commented 13 years ago

Just this basic one, at the bottom as soon as i do {% i get the error. I am trying to get this to work on a Gentoo sun-jdk 1.6.0.26 machine and am having the issue. Miguel over twitter pointed to this post: http://j.mp/T3ts9 however I am not sure it is the same error. He was saying it may be an issue with the JDK. We did test this on a Ubuntu machine and it seemed to work.

{% extends "AcmeDemoBundle::layout.html.twig" %}

{% block title "Hello " ~ name %}

{% block content %}
    <h1>Hello {{ name }}!</h1>
{% endblock %}

{% set code = code(_self) %}
pulse00 commented 13 years ago

i doubt that the problem you encounter has something todo with the Smarty parser. Although the Twig parser is based on the smarty parser, the error above is not likely to have the same cause as the smarty plugin does not implement a DOMModelParser at all.

I've tried to reproduce it with the twig template you've just posted, but unfortunately i'm getting codeassist without any exception: http://imageshack.us/f/12/shotcs.png/

Just to make sure: since you've created the issue i have released another version of the plugins. The current versions are:

daum commented 13 years ago

Sure here is the versions plus an updated output: Eclipse SDK 3.7.0.I20110613-1736 org.eclipse.sdk.ide null PHP Development Tools (PDT) All-In-One SDK 3.0.0.v201108100912-77--7C91A5Ad78NNckQijUdWUskW org.eclipse.php.all.feature.group Eclipse.org Symfony Core Feature 1.0.32.201108062100 com.dubture.symfony.feature.feature.group https://github.com/pulse00/Symfony-2-Eclipse-Plugin Symfony Twig Support 1.0.32.201108062100 com.dubture.symfony.twigfeature.feature.group https://github.com/pulse00/Symfony-2-Eclipse-Plugin Twig Editor Feature 1.0.84.201108062100 com.dubture.twig.feature.feature.group https://github.com/pulse00/Twig-Eclipse-Plugin

java.lang.NullPointerException
        at com.dubture.twig.core.documentModel.TwigDOMModelParser.computeNestedTag(TwigDOMModelParser.java:87)
        at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertNestedTag(XMLModelParser.java:1226)
        at org.eclipse.wst.xml.core.internal.document.XMLModelParser.insertStructuredDocumentRegion(XMLModelParser.java:1532)
        at org.eclipse.wst.xml.core.internal.document.XMLModelParser.changeStructuredDocumentRegion(XMLModelParser.java:550)
        at org.eclipse.wst.xml.core.internal.document.XMLModelParser.replaceRegions(XMLModelParser.java:2317)
        at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.regionsReplaced(DOMModelImpl.java:846)
        at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument._fireEvent(BasicStructuredDocument.java:571)
        at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.fireStructuredDocumentEvent(BasicStructuredDocument.java:1189)
        at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.internalReplaceText(BasicStructuredDocument.java:1968)
        at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2423)
        at org.eclipse.wst.sse.core.internal.text.BasicStructuredDocument.replaceText(BasicStructuredDocument.java:2408)
        at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.access$2(JobSafeStructuredDocument.java:1)
        at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument$3.run(JobSafeStructuredDocument.java:141)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.wst.sse.ui.EditorExecutionContext.execute(EditorExecutionContext.java:149)
        at org.eclipse.wst.sse.core.internal.text.JobSafeStructuredDocument.replaceText(JobSafeStructuredDocument.java:144)
        at org.eclipse.wst.sse.ui.internal.StructuredDocumentToTextAdapter.replaceTextRange(StructuredDocumentToTextAdapter.java:1187)
        at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7180)
        at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7994)
        at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2456)
        at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5911)
        at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5941)
        at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5635)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
        at org.eclipse.swt.widgets.Widget.sendIMKeyEvent(Widget.java:1344)
        at org.eclipse.swt.widgets.Control.gtk_commit(Control.java:2840)
        at org.eclipse.swt.widgets.Canvas.gtk_commit(Canvas.java:160)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1733)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
        at org.eclipse.swt.internal.gtk.OS._gtk_im_context_filter_keypress(Native Method)
        at org.eclipse.swt.internal.gtk.OS.gtk_im_context_filter_keypress(OS.java:7793)
        at org.eclipse.swt.widgets.Control.filterKey(Control.java:2250)
        at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3012)
        at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
        at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
        at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8394)
        at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
        at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
        at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2258)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
pulse00 commented 13 years ago

ok, this is a tricky one... the exception you're seeing should at least not crash the whole codeassist, it's simply debug output which is cought normally:

https://github.com/pulse00/Twig-Eclipse-Plugin/blob/master/com.dubture.twig.core/src/com/dubture/twig/core/documentModel/TwigDOMModelParser.java#L97

i'll try to get hands on a VMWare with gentoo and the sun-jdk, maybe i can reproduce the problem there.

daum commented 13 years ago

Just checked with jre-bin and jdk both are giving the same error.

daum commented 13 years ago

It works now updated some of my java libs.