eclipse.jdt.ls icon indicating copy to clipboard operation
eclipse.jdt.ls copied to clipboard

Customizing org.eclipse.jdt.core.prefs

Open asmodeus812 opened this issue 3 years ago • 3 comments

Hi, I am wondering if jdt provides a way to customize the contents of the .settings folder contents, I do realize that some if not all of those filese in there are generated automatically based on the project config. But i was looking for a way to dynamically add overrides for certain properties - for example, formatting settings. Maybe there is a way to do that through the settings payload or when starting jdt - an environment / -D variable ? Thanks in advance. The idea here is to be able to enhance the file programmatically and evne handle cases where i force jdt to clean workspace settings/cache and re-start.

asmodeus812 avatar Aug 07 '22 06:08 asmodeus812

@asmodeus812 You may want to take a look at Formatter settings and Settings Global Preferences

snjeza avatar Aug 07 '22 15:08 snjeza

Thanks, i have had a look at the formatter settings, the second link however seems promising. Seems like that settings file will be sufficient to add user defined properties. Is the format of settings.prefs the same as the ones jdt uses from the .settings folder such as *.core.prefs etc ? Had to clarify i am not using eclipse as a client but a third party software - neovim.

asmodeus812 avatar Aug 08 '22 03:08 asmodeus812

Thanks, i have had a look at the formatter settings, the second link however seems promising. Seems like that settings file will be sufficient to add user defined properties. Is the format of settings.prefs the same as the ones jdt uses from the .settings folder such as *.core.prefs etc ? Had to clarify i am not using eclipse as a client but a third party software - neovim.

Yes, the format of the file should be identical, because we are essentially reading/setting the preferences in the same way. Also, like the format documentation mentions, it should even be possible to list the formatter settings (which are stored as xml files) as just key=value pairs in the setting file as well.

Only thing that may be tricky, is in the past I have run into cases where dynamic changes to the settings file sometimes fail to get updated immediately, but if that happens, it's a bug that should be filed to investigate.

rgrunber avatar Aug 09 '22 15:08 rgrunber

Great, thanks for the answer, i think this can be closed, answers the initial question.

asmodeus812 avatar Aug 10 '22 11:08 asmodeus812