When I update from 2.27.0 to 2.28.0, all my LSP tests that use testCodeAction fail with a NullPointerException because the Resource is null:
java.lang.NullPointerException: Cannot invoke "org.eclipse.emf.ecore.resource.Resource.getContents()" because "resource" is null
at org.contextmapper.dsl.cml.CMLResource.<init>(CMLResource.java:51)
at org.contextmapper.dsl.ide.actions.CMLActionService.getCodeActions(CMLActionService.java:49)
at org.eclipse.xtext.ide.server.LanguageServerImpl.codeAction(LanguageServerImpl.java:798)
at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$codeAction$37(LanguageServerImpl.java:779)
at org.eclipse.xtext.testing.AbstractLanguageServerTest$DirectRequestManager.runRead(AbstractLanguageServerTest.java:149)
at org.eclipse.xtext.ide.server.LanguageServerImpl.codeAction(LanguageServerImpl.java:779)
at org.eclipse.xtext.testing.AbstractLanguageServerTest.testCodeAction(AbstractLanguageServerTest.java:1083)
... 71 more
Example test (Xtend):
@Test
def void canOfferCodeAction() {
testCodeAction [
model = '''
UserStory TestStory {
As a "Tester"
I want to create a "UnitTest"
so that "I can ensure that my quickfix is suggested in the CML editor."
}
'''
expectedCodeActions = '''
command : cml.ar.deriveSubdomainFromURs.proxy
title : Derive Subdomain From User Requirements
args :
file://«this.root»/MyModel.cml,TestStory
title : Split Story by Verb/Operation
kind : quickfix
command : Command [
title = "Split Story by Verb/Operation"
command = "cml.quickfix.command.splitStoryByVerb.proxy"
arguments = LinkedList (
"file://«this.root»/MyModel.cml",
"TestStory"
)
]
codes : split-feature-by-verb-suggestion
edit :
'''
]
}
I extend AbstractLanguageServerTest and for the actions I implement ICodeActionService2.
The problem is that the resource property of the options parameter (getCodeActions of ICodeActionService2) is always null with 2.28.0. With 2.27.0 it works fine.
Hi here!
When I update from 2.27.0 to 2.28.0, all my LSP tests that use
testCodeAction
fail with a NullPointerException because theResource
is null:Example test (Xtend):
I extend
AbstractLanguageServerTest
and for the actions I implementICodeActionService2
.The problem is that the
resource
property of theoptions
parameter (getCodeActions
ofICodeActionService2
) is alwaysnull
with 2.28.0. With 2.27.0 it works fine.Any ideas? Do I have to change my tests somehow?
Thanks in advance! Stefan