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

LS Wizard should validate the configuration options are valid JSON #157

Open
fbricon opened this issue Mar 11, 2024 · 1 comment
Open

LS Wizard should validate the configuration options are valid JSON #157

fbricon opened this issue Mar 11, 2024 · 1 comment
Labels
bug Something isn't working user-defined LS

Comments

@fbricon
Copy link
Contributor

fbricon commented Mar 11, 2024

In a user defined LS settings page, if you put invalid json into one of the configuration fields and apply the changes, IJ will throw an exception:

Error while parsing JSON Initialization Options for the language server 'f8f5f681-d78a-4011-bab1-e583018885e2'

com.google.gson.JsonSyntaxException: java.io.EOFException: End of input at line 3 column 1 path $.provideFormatter
	at com.google.gson.internal.Streams.parse(Streams.java:59)
	at com.google.gson.JsonParser.parseReader(JsonParser.java:102)
	at com.google.gson.JsonParser.parseReader(JsonParser.java:70)
	at com.redhat.devtools.lsp4ij.server.definition.launching.UserDefinedLanguageServerDefinition.getLanguageServerInitializationOptions(UserDefinedLanguageServerDefinition.java:104)
	at com.redhat.devtools.lsp4ij.server.definition.launching.UserDefinedStreamConnectionProvider.getInitializationOptions(UserDefinedStreamConnectionProvider.java:68)
	at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$0(LanguageServerWrapper.java:326)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.io.EOFException: End of input at line 3 column 1 path $.provideFormatter
	at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1457)
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:491)
	at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:422)
	at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:779)
	at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:725)
	at com.google.gson.internal.Streams.parse(Streams.java:49)
	... 12 more

This should be caught before applying the changes.

@fbricon fbricon added the bug Something isn't working label Mar 11, 2024
@angelozerr
Copy link
Contributor

IMHO I think we should have a JSON Editor or delegate that in an IJ editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user-defined LS
Projects
None yet
Development

No branches or pull requests

2 participants