theia-ide/theia-xtext

Cross reference within my language only working on first initialized workspace?

Opened this issue · 4 comments

In eclipse my language is working how i expect it, also cross references between multiple source files.
But in theia the corss references only work if they already used in the "example-workspace" which is loaded on first opening.
Am i missing something? Or do i have to add anything to get this work?

xtext currently does not support

https://microsoft.github.io//language-server-protocol/specifications/specification-3-14/#workspace_didChangeWorkspaceFolders

eclipse/xtext-core#1238

=> only the initial projects, but new files will be supported.
thus i wonder what exaclty you do to reproduce this problem

(creating and using new files should work fine - at least on the xtext side of this)

In your example everything is working.

I am not changing the workspace location.
If i create a new file and add a new field i cant refer to it in an other file.

theia shows this as a problem:
Couldn't resolve reference to FieldOfEntityORFieldOfEntityOData 'Description'. [org.eclipse.xtext.diagnostics.Diagnostic.Linking] (19, 6)

In the eclispe IDE it is working.

If i save the new file and reload (browser reload) the whole theia ide, the problems disappear and everything seems to be working fine.

edit: i am using my own xtext dsl language

then i wonder how you have implemented scoping and if the change to file a leads to file b beeing affected and recalculated

e.g. arround

org.eclipse.xtext.build.Indexer.computeAndIndexAffected(BuildRequest, BuildContext)

I do not override anything from the Indexer.

You are right, there is a problem within the implementation of my custom ScopeProvider.
After some digging and adding logs i found this exception:

ERROR|io.storm.model.dsl.scoping.StormScopeProvider|Unexpected custom scoping errors in storm context class class io.storm.model.dsl.storm.impl.ModelImplreferencing field "associatedEntityType" of class "EReferenceImpl" in file #null: NullPointerException(null). The error happened in the Context of io.storm.model.dsl.storm.impl.ModelImpl@28683443 (eProxyURI: file:///workspace/theia-xtext/example-workspace/src/entities.storm#/) StackTrace:java.lang.NullPointerException
        at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:103)
        at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:97)
        at io.storm.model.dsl.language.StormCustomScopeProvider.getScope(StormCustomScopeProvider.java:905)
        at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
        at io.storm.model.dsl.language.StormCustomScopeProvider.getScope(StormCustomScopeProvider.java:934)
        at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
        at io.storm.model.dsl.language.StormCustomScopeProvider.getScope(StormCustomScopeProvider.java:934)
        at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
        at io.storm.model.dsl.language.StormCustomScopeProvider.getScope(StormCustomScopeProvider.java:934)
        at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
        at io.storm.model.dsl.language.StormCustomScopeProvider.getScope(StormCustomScopeProvider.java:934)
        at org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider._createProposals(IdeContentProposalProvider.java:178)
        at org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider.createProposals(IdeContentProposalProvider.java:194)
        at org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider._createProposals(IdeContentProposalProvider.java:110)
        at org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider.createProposals(IdeContentProposalProvider.java:191)
        at org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider.createProposals(IdeContentProposalProvider.java:94)
        at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createProposals(ContentAssistService.java:115)
        at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createCompletionList(ContentAssistService.java:80)
        at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$completion$35(LanguageServerImpl.java:597)
        at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:334)
        at org.eclipse.xtext.ide.server.LanguageServerImpl.completion(LanguageServerImpl.java:599)
        at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$completion$34(LanguageServerImpl.java:578)
        at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$run$0(ReadRequest.java:37)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)