Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Providing library for an XText IDEA plugin
Providing library for an XText IDEA plugin [message #1743806] Mon, 19 September 2016 18:39 Go to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
Today I reached the chapter "Scoping" in the book of Lorenzo (2nd edition). I'm trying to provide a custom library for my IDEA plugin but so far did not manage to make anything work. The chapter is very much Eclipse-oriented and does not cover my particular tool set:

IDEA 20016.2.4
XText 2.10
Gradle 3.0

I develop under IDEA and build a plugin for IDEA.

I'm using the default Gradle source layout which gives the following tree:

flax.parent
  flax
  flax.ide
  flax.idea
  flax.web


I did the following:

a) Created a flax.parent/flax/src/main/lib.flax file containing:

package flax.lang
class Object {}


b) Modified the flax/build.gradle file to include the following:

jar {
    manifest {
        attributes("Export-Package":"flax.lang")
    }
}


c) Use my plugin via the "runIdea" task and create the following file:

class Youpi extends flax.lang.Object {}


Unfortunately IDEA complains that "flax.lang.Object" is an undefined symbol.

Am I missing something obvious?
Re: Providing library for an XText IDEA plugin [message #1743808 is a reply to message #1743806] Mon, 19 September 2016 19:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Did you add the object containing jar to the classpath of the youpi containing project?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Providing library for an XText IDEA plugin [message #1743809 is a reply to message #1743806] Mon, 19 September 2016 19:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Did you add the object containing jar to the classpath of the youpi containing project?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Providing library for an XText IDEA plugin [message #1743810 is a reply to message #1743809] Mon, 19 September 2016 19:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
And you might. Need to add the main lib as resources folder so that grade actually packages it

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Providing library for an XText IDEA plugin [message #1743813 is a reply to message #1743810] Mon, 19 September 2016 21:07 Go to previous messageGo to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
I assume that adding the jar as a module dependency (IDEA terminology) is what I should do.

If that is the case then it is a complete disaster Sad

IDEA repeatedly complains with the following error whenever I press CTRL+SPACE:

resolution of uriFragment '|0' failed.
java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions.getContainer(ChunkedResourceDescriptions.java:182)
	at org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager.getVisibleContainers(ProjectDescriptionBasedContainerManager.java:82)
	at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getVisibleContainers(DefaultGlobalScopeProvider.java:72)
	at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getScope(DefaultGlobalScopeProvider.java:49)
	at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getScope(DefaultGlobalScopeProvider.java:61)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider.getScope(AbstractGlobalScopeProvider.java:50)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:42)
	at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:104)
	at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:97)
	at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
	at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
	at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
	at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
	at org.eclipse.xtext.scoping.impl.DelegatingScopeProvider.delegateGetScope(DelegatingScopeProvider.java:42)
	at org.eclipse.xtext.scoping.impl.DelegatingScopeProvider.getScope(DelegatingScopeProvider.java:38)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getScope(DefaultLinkingService.java:59)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:119)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:247)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:222)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doResolveLazyCrossReference(LazyLinkingResource.java:189)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReference(LazyLinkingResource.java:148)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReferences(LazyLinkingResource.java:134)
	at org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences(EcoreUtil2.java:498)
	at org.eclipse.xtext.psi.impl.BaseXtextFile.createResource(BaseXtextFile.java:149)
	at org.eclipse.xtext.psi.impl.BaseXtextFile$1.compute(BaseXtextFile.java:89)
	at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
	at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:65)
	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
	at org.eclipse.xtext.psi.impl.BaseXtextFile.getResource(BaseXtextFile.java:108)
	at org.eclipse.xtext.psi.impl.BaseXtextFile.getINode(BaseXtextFile.java:112)
	at org.eclipse.xtext.psi.impl.XtextPsiReferenceImpl.getCrossReferenceDescription(XtextPsiReferenceImpl.java:192)
	at org.eclipse.xtext.psi.impl.XtextPsiReferenceImpl.getRangeToHighlightInElement(XtextPsiReferenceImpl.java:89)
	at org.eclipse.xtext.psi.impl.XtextPsiReferenceImpl.getRanges(XtextPsiReferenceImpl.java:143)
	at com.intellij.psi.ReferenceRange.getRanges(ReferenceRange.java:36)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.addReferences(SharedPsiElementImplUtil.java:82)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:49)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:67)
	at com.intellij.psi.impl.PsiElementBase.findReferenceAt(PsiElementBase.java:87)
	at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:494)
	at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:466)
	at com.intellij.psi.impl.source.PsiFileImpl.findReferenceAt(PsiFileImpl.java:634)
	at com.intellij.codeInsight.completion.CompletionData.getReferencePrefix(CompletionData.java:159)
	at com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:192)
	at com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:203)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.createResultSet(CompletionServiceImpl.java:91)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:80)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:110)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:776)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$500(CompletionProgressIndicator.java:90)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:758)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:87)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:848)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$1(CompletionThreading.java:84)
	at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$2(CompletionThreading.java:82)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)


Removing the jar dependency makes cross-referencing works again.

I did not even try to add the library file as a resource...
Re: Providing library for an XText IDEA plugin [message #1743826 is a reply to message #1743813] Tue, 20 September 2016 06:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Can you open a ticket with a reproducing sample attached

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Providing library for an XText IDEA plugin [message #1743827 is a reply to message #1743826] Tue, 20 September 2016 06:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Ps unfortunately the idea support is very buggy and there is Indonesien with time Knowledge and budget to fix it

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Providing library for an XText IDEA plugin [message #1743929 is a reply to message #1743827] Tue, 20 September 2016 17:27 Go to previous messageGo to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
I filed a bug:

https://github.com/eclipse/xtext/issues/1075

Re: Providing library for an XText IDEA plugin [message #1744056 is a reply to message #1743929] Wed, 21 September 2016 19:40 Go to previous messageGo to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
Maybe I should have filed it for xtext-idea instead of xtext?
Re: Providing library for an XText IDEA plugin [message #1744065 is a reply to message #1744056] Thu, 22 September 2016 05:57 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:cross-references without grammar
Next Topic:xtext feature project
Goto Forum:
  


Current Time: Fri Apr 26 05:29:41 GMT 2024

Powered by FUDForum. Page generated in 0.03956 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top