vscode-java: Formatter doesn't load format config after update

After updating to the latest version of the plugin, the format configuration configured no longer is used when formatting files through vscode.

Environment
  • Operating System: Windows
  • JDK version: 11
  • Visual Studio Code version: 1.55.2
  • Java extension version: 0.79.0
Steps To Reproduce
  1. Place eclipse xml file on the file system tested with version 18 format
  2. Configure url to point to file in global settings Java > Format > Settings: Url with format file:///D:/<file location>
  3. Open java project
  4. Format java file in project
  5. Formatting uses default formatting and not the formatting configured in the xml file.
Current Result

File is formatted with the default format profile not the provided xml config

Expected Result

File is formatted with the provided xml config

Additional Informations

Prior to the update the profile name inside the xml file didn’t need to be provided and formatting worked correctly, not sure which version I came from or if you have a way I could get that information for you.

After update if the profile isn’t provided a null pointer exception occurs and is as follows. Providing the profile name results in no NullPointerException but also doesn’t format according to the config file.

java.lang.NullPointerException
	at org.eclipse.jdt.internal.ui.preferences.formatter.ProfileVersionerCore.updateAndComplete(ProfileVersionerCore.java:98)
	at org.eclipse.jdt.ls.core.internal.managers.FormatterManager.readSettingsFromStream(FormatterManager.java:181)
	at org.eclipse.jdt.ls.core.internal.managers.FormatterManager.configureFormatter(FormatterManager.java:191)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.didChangeConfiguration(JDTLanguageServer.java:474)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 26 (11 by maintainers)

Most upvoted comments

Same here - please note I had to revert to 0.77 (as 0.78 and 0.79 both fail) so the regression is likely in 0.78.

@Nightenom ok. Thank you!

@OzelotVanilla Yes, it helps. Thanks.