Formatter doesn't load format config after update
See original GitHub issueAfter 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
- Place eclipse xml file on the file system tested with version 18 format
- Configure url to point to file in global settings Java > Format > Settings: Url with format
file:///D:/<file location>
- Open java project
- Format java file in project
- 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:
- Created 2 years ago
- Reactions:5
- Comments:26 (11 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
@future2r Could you try https://github.com/snjeza/vscode-test/raw/master/java-0.79.1.vsix ?