Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Disable DocumentSymbolService for Binary Files
Disable DocumentSymbolService for Binary Files [message #1800067] Wed, 19 December 2018 08:57 Go to next message
Eclipse UserFriend
In our XText Grammar which is written for a VS-Code Extension, it is possible to reference image files that are in the workspace.

Language Server Protocol supports jump to definition for all text resources, however, currently, there seems to be no support for binary files.

Thus, when the user tries do jump to def for an image reference, the xtext server throws the following herror

Error - 2:53:18 PM] Request textDocument/definition failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
	at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:647)
	at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$run$0(ReadRequest.java:43)
	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)
Caused by: java.lang.NullPointerException
	at org.eclipse.xtext.ide.server.WorkspaceManager.getDocument(WorkspaceManager.java:292)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:282)
	at org.eclipse.xtext.ide.server.findReferences.WorkspaceResourceAccess.readOnly(WorkspaceResourceAccess.java:42)
	at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.doRead(DocumentSymbolService.java:364)
	at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:126)
	at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:107)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$36(LanguageServerImpl.java:607)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:283)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:609)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$35(LanguageServerImpl.java:590)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$run$0(ReadRequest.java:37)
	... 4 more


The error is coming from the DocumentSymbolService, I tried to disable this service in the runtime module representing this resource.

class ImagesRuntimeModule extends AbstractGenericModule {
	
	 def Class<? extends IResourceFactory> bindIResourceFactory() {
		return typeof(ImageResourceFactory);
	}
	
	def Class<? extends IResourceServiceProvider> bindIResourceServiceProvider() {
		return typeof(ImageResourceServiceProvider);
	}
	
	def void configureFileExtensions(Binder binder) {
		
			binder.bind(typeof(String)).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("png,jpg,jpeg");
	}	

	def Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
		return typeof(ResourceQualifiedNameProvider);
	}
	
	def Class<? extends DocumentSymbolService> bindIDocumentSymbolService() {
		return typeof(EmptyDocumentSymbolService);
	}
}


with EmptyDocumentSymbolService doing nothing.

However, I cannot disable it, XText's documentSymbolService is still running.

How can I solve this problem?
Re: Disable DocumentSymbolService for Binary Files [message #1800068 is a reply to message #1800067] Wed, 19 December 2018 09:05 Go to previous messageGo to next message
Eclipse UserFriend
DocumentSymbolService should be bound in ServerModule since it is not language specific.
can you give more details on why the error happens
e.g. how to reproduce? where do your uris point to? this this no dsl? how can it be in the index then?
Re: Disable DocumentSymbolService for Binary Files [message #1800073 is a reply to message #1800068] Wed, 19 December 2018 10:13 Go to previous message
Eclipse UserFriend
Why should you jump to a definition to a binary? I doubt that's the intention of the protocol here. However, there should be no NPE here, this should exit more gracefully.
Previous Topic:How to create complete code suggestions in Xtext Eclipse Plugin?
Next Topic:Serialize DSL model from with out Xtext Web project classes
Goto Forum:
  


Current Time: Tue Jun 17 01:34:19 EDT 2025

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

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

Back to the top