DSLD Code assist for parametrized procedures

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DSLD Code assist for parametrized procedures

Jakub Trojanek
This post has NOT been accepted by the mailing list yet.
Hi,
I started experimenting with DSLD and stumbled on following issue:
when I make a contribution of property or unparametrized method, it works fine.
When I contribute method with any parameters, code assist show it correctly but when trying to select it (by Enter, Space or mouse click), code assist exits, name is not completed in code and I get Unhandled event loop exception in eclipse error log. Seems currentScope is null in CompletionContext.

The same goes when I delegateTo a type - its properties and unparametrized methods work ok.
I have java 1.6.0_14, eclipse 3.7, and plugin 2.5.1

Is it a bug or do I have some configuration problem? Strange that such a fundamental functionality would be missed, so surely it is something with my setup?

You can see it on dsld as simple as:

currentType(fileName("build.gradle")).accept { delegatesTo("org.gradle.api.Project") }

Thanks in advance!
Jakub

Log is below:

Env:
eclipse.buildId=I20110613-1736
java.version=1.6.0_14
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product

StackTrace:
java.lang.NullPointerException
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyExtendedCompletionContext.computeVisibleElements(GroovyExtendedCompletionContext.java:101)
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyExtendedCompletionContext.getVisibleElements(GroovyExtendedCompletionContext.java:89)
        at org.eclipse.jdt.internal.codeassist.InternalCompletionContext.getVisibleElements(InternalCompletionContext.java:318)
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyJavaGuessingCompletionProposal.getAssignableElements(GroovyJavaGuessingCompletionProposal.java:125)
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyJavaGuessingCompletionProposal.guessParameters(GroovyJavaGuessingCompletionProposal.java:393)
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyJavaGuessingCompletionProposal.computeGuessingCompletion(GroovyJavaGuessingCompletionProposal.java:294)
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyJavaGuessingCompletionProposal.computeReplacementString(GroovyJavaGuessingCompletionProposal.java:221)
        at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getReplacementString(LazyJavaCompletionProposal.java:330)
        at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.apply(AbstractJavaCompletionProposal.java:364)
        at org.eclipse.jdt.internal.ui.text.java.JavaMethodCompletionProposal.apply(JavaMethodCompletionProposal.java:57)
        at org.codehaus.groovy.eclipse.codeassist.proposals.GroovyJavaGuessingCompletionProposal.apply(GroovyJavaGuessingCompletionProposal.java:136)
        at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.apply(AbstractJavaCompletionProposal.java:477)
        at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.apply(LazyJavaCompletionProposal.java:488)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:930)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:881)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1307)
        at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:807)
        at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:491)
        at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:65)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
        at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5936)
        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:1053)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
        at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
        at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
        at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1509)
        at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
        at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
        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)
Reply | Threaded
Open this post in threaded view
|

Re: DSLD Code assist for parametrized procedures

Jakub Trojanek
This post has NOT been accepted by the mailing list yet.
I did some testing and this happens only outside source folders, when doing it inside content assist works as expected.
Still, I think a fix would be needed, e.g. for leveraging DSLD on gradle build scripts located in projects root.
Jakub

Jakub Trojanek wrote
Hi,
I started experimenting with DSLD and stumbled on following issue:
when I make a contribution of property or unparametrized method, it works fine.
When I contribute method with any parameters, code assist show it correctly but when trying to select it (by Enter, Space or mouse click), code assist exits, name is not completed in code and I get Unhandled event loop exception in eclipse error log. Seems currentScope is null in CompletionContext.

The same goes when I delegateTo a type - its properties and unparametrized methods work ok.
I have java 1.6.0_14, eclipse 3.7, and plugin 2.5.1

Is it a bug or do I have some configuration problem? Strange that such a fundamental functionality would be missed, so surely it is something with my setup?

You can see it on dsld as simple as:

currentType(fileName("build.gradle")).accept { delegatesTo("org.gradle.api.Project") }

Thanks in advance!
Jakub