Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xtext LSP vscode integration exception thrown on content assist #3274

Closed
srinivasiyermv opened this issue Dec 2, 2024 · 7 comments
Closed

Comments

@srinivasiyermv
Copy link
Contributor

Hello all,

I am trying to integrate a simple DSL based on xtext with vscode .. I followed the demo application .. While integrating into my sample everything works apart from content assist. We get below error . Any idea what needs to be fixed here

Using the latest lsp4j and language client as described in demo .

47734688 [pool-1-thread-5] ERROR t.antlr.ContentAssistContextFactory  - java.lang.RuntimeException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.doCreateContexts(ContentAssistContextFactory.java:181)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.create(ContentAssistContextFactory.java:131)
	at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createProposals(ContentAssistService.java:106)
	at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createCompletionList(ContentAssistService.java:78)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$26(LanguageServerImpl.java:587)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:458)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.completion(LanguageServerImpl.java:586)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$25(LanguageServerImpl.java:572)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$1(ReadRequest.java:66)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
	at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:246)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:237)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:232)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:49)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:1)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:264)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.handleLastCompleteNodeIsAtEndOfDatatypeNode(ContentAssistContextFactory.java:230)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$2.call(ContentAssistContextFactory.java:161)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory$2.call(ContentAssistContextFactory.java:1)
	... 4 more
Caused by: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base/java.lang.Class.getMethod(Class.java:2387)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:169)
	at org.eclipse.xtext.ide.editor.contentassist.antlr.BaseContentAssistParser.getFollowElements(BaseContentAssistParser.java:242)
	... 12 more
@cdietrich
Copy link
Contributor

hi, i propose you debug what is null. why is the method not found?
also: do you have a reproducer?
maybe you are doing something unexpected in grammar.

@srinivasiyermv
Copy link
Contributor Author

Thanks Christian for quick response .. I dont have reproducer . However debugging found out that rule object id are different which is causing null

org.eclipse.xtext.xtext.RuleNames

public String getAntlrRuleName(AbstractRule rule) {
		return antlrNameToRule.inverse().get(rule);
	}

Object id are different as compared to the antlrNameToRule.inverse() however the rule names are present . Looks like the parse which we inject from IDE is different .. Correct me is this right understanding .Thanks

@cdietrich
Copy link
Contributor

yes but the question is why.
do you have customized any bindings?
do you have multiple file extension?

@srinivasiyermv
Copy link
Contributor Author

srinivasiyermv commented Dec 2, 2024

We have custom Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() this is only customized bindings which is added in ide .

We dont have multiple file extension

@cdietrich
Copy link
Contributor

and what did you customize?

@cdietrich
Copy link
Contributor

i really need a reproducer

@srinivasiyermv
Copy link
Contributor Author

Thanks Christian .. Will try to create a reproducer and check if its reproducible with similar scenario and get back to you. May be you could close this issue as its more relevant for our use case. Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants