question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formatter doesn't load format config after update

See original GitHub issue

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)

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
marcanpilamicommented, May 1, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Prettier not format code in VS Code? - Stack Overflow
Open Files -> Preferences -> Settings (or Ctrl + , in Windows). Search for Editor: Default Formatter; Select your default formatter as Prettier ......
Read more >
logging.config — Logging configuration — Python 3.11.1 ...
The configuration file format understood by fileConfig() is based on configparser functionality. The file must contain sections called [loggers] , [handlers] ...
Read more >
How to enable auto format on save with prettier in VS Code ...
Explainer video about How to enable auto format on save in VS Code (Visual Studio Code) editor with prettier code formatter extension on...
Read more >
Change the Windows regional settings to modify the ...
Change the regional settings · Click the Start button, and then click Control Panel. · Click Change date, time, or number formats. ·...
Read more >
360711 – Formatter profile sometimes ignored, defaults used ...
Problem: Newly imported formatter profile is active in the JDT/UI options, but JDT/Core options/preferences doesn't have the updated formatter settings.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found