You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.format.settings.url should point to a valid formatter file and do not set java.format.settings.profile at all. Formatting should work as expected.
Now change java.format.settings.profile to a name that doesn't exist in the formatter file. You'll need to restart the language server as it seems changing the profile name does not affect the formatter used automatically.
You should see the following error :
[Error - 2:23:37 PM] May 5, 2021, 2:23:37 PM Cannot invoke "java.util.Map.entrySet()" because "oldSettings" is null
Cannot invoke "java.util.Map.entrySet()" because "oldSettings" is null
java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "oldSettings" is null
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:171)
at org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager.configureSettings(StandardProjectsManager.java:276)
at org.eclipse.jdt.ls.core.internal.managers.StandardProjectsManager$3.preferencesChange(StandardProjectsManager.java:534)
at org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager$1.run(PreferenceManager.java:212)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager.preferencesChanged(PreferenceManager.java:215)
at org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager.update(PreferenceManager.java:183)
at org.eclipse.jdt.ls.core.internal.preferences.StandardPreferenceManager.update(StandardPreferenceManager.java:66)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.handleInitializationOptions(BaseInitHandler.java:116)
at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:72)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:235)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$0(ParentProcessWatcher.java:123)
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:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
Update : Seems like an exception could be thrown if the profile name doesn't match anything, or fSettings could be initialized and passed forward. I'd be inclined to have an empty profile name behave the same way as null does.
Update 2 : Changing the formatter file works perfectly. I think it's just changing the profile name that requires a restart.
The text was updated successfully, but these errors were encountered:
java.format.settings.url
should point to a valid formatter file and do not setjava.format.settings.profile
at all. Formatting should work as expected.Now change
java.format.settings.profile
to a name that doesn't exist in the formatter file. You'll need to restart the language server as it seems changing the profile name does not affect the formatter used automatically.You should see the following error :
One might delete the profile name and restart but that still won't fix things because the profile name is now just an empty string, and only a null value would have properly loaded the (default?) settings. See https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/FormatterManager.java#L79 .
Update : Seems like an exception could be thrown if the profile name doesn't match anything, or fSettings could be initialized and passed forward. I'd be inclined to have an empty profile name behave the same way as null does.
Update 2 : Changing the formatter file works perfectly. I think it's just changing the profile name that requires a restart.
The text was updated successfully, but these errors were encountered: