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

NPE on SemanticTokens #861

Closed
laeubi opened this issue Oct 26, 2023 · 1 comment
Closed

NPE on SemanticTokens #861

laeubi opened this issue Oct 26, 2023 · 1 comment

Comments

@laeubi
Copy link

laeubi commented Oct 26, 2023

Exception in thread "org.eclipse.jface.text.reconciler.Reconciler" java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because "dataStream" is null
	at org.eclipse.lsp4e.operations.semanticTokens.SemanticHighlightReconcilerStrategy.saveStyle(SemanticHighlightReconcilerStrategy.java:190)
	at org.eclipse.lsp4e.operations.semanticTokens.VersionedSemanticTokens.apply(VersionedSemanticTokens.java:40)
	at org.eclipse.lsp4e.operations.semanticTokens.SemanticHighlightReconcilerStrategy.lambda$5(SemanticHighlightReconcilerStrategy.java:271)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at org.eclipse.lsp4e.operations.semanticTokens.SemanticHighlightReconcilerStrategy.fullReconcile(SemanticHighlightReconcilerStrategy.java:270)
	at org.eclipse.lsp4e.operations.semanticTokens.SemanticHighlightReconcilerStrategy.initialReconcile(SemanticHighlightReconcilerStrategy.java:288)
	at org.eclipse.ui.internal.genericeditor.CompositeReconcilerStrategy.initialReconcile(CompositeReconcilerStrategy.java:48)
	at org.eclipse.jface.text.reconciler.Reconciler.initialProcess(Reconciler.java:223)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:177)

this seem to happen when returning an empty SemanticTokens like this from an lsp4j server:

@Override
public CompletableFuture<SemanticTokens> semanticTokensFull(SemanticTokensParams params) {
	return withDocument(params.getTextDocument(), document -> {
		SemanticTokens tokens = new SemanticTokens();
		...
		return tokens;
	});
}
@sebthom
Copy link
Contributor

sebthom commented Nov 27, 2023

The issue has been fixed upstream in lsp4j

@sebthom sebthom closed this as completed Nov 27, 2023
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