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

ReflectiveMessageValidator reports "Lists must not contain null references." for null values in response to workspace/configuration #861

Open
jansorg opened this issue Dec 21, 2024 · 1 comment

Comments

@jansorg
Copy link

jansorg commented Dec 21, 2024

LSP4J 0.23.1

The LSP contains this about the response to the workspace/configuration request:

If the client can’t provide a configuration setting for a given scope then null needs to be present in the returned array.

LSP4J's method signature requires to return a List<Object>, but ReflectiveMessageValidator always seems to report null values in lists as incorrect.

@JsonRequest("workspace/configuration")
	default CompletableFuture<List<Object>> configuration(ConfigurationParams configurationParams) {
		throw new UnsupportedOperationException();
	}

When I return a null configuration value, this is reported by the message validator:

Caused by: org.eclipse.lsp4j.jsonrpc.MessageIssueException: Lists must not contain null references. Path: $.result[0]
	at org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.consume(ReflectiveMessageValidator.java:67)

As far as I understand null values to the configuration request should be accepted by the message validator.

@pisv
Copy link
Contributor

pisv commented Dec 21, 2024

@jansorg Can you try using JsonNull.INSTANCE instead of null?

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