Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] Enabling the new experimental formatter

Hi,

Starting with the next integration build. Here is a way to enable the new
experimental code formatter. I am saying it is experimental because there
is still a lot of work to be done. For example, you cannot format any code
snippet anymore. For now it has to be a whole compilation unit. without any
syntax error.

If you format a compilation unit and you get compile errors (and you had no
compile error prior to formatting) or a source starting with "COULD NOT
FORMAT", then you found a code pattern that is not well supported. In this
case, please open a bug report against JDT/Core with [Formatter] in the
title. That will help us to track them down.

So to enable the new formatter, start a new workspace and close it.
In the .metadata\.plugins\org.eclipse.jdt.core folder, you have a file
called pref_store.ini. At the end of this file, add the following line:

org.eclipse.jdt.core.newformatter.activation=enabled

And start the workspace again. This will activate the new formatter each
time you format a compilation unit or you use the format action without
selecting any code. To disable it, remove the line and restart your
workspace or change enabled for disabled.

Once it is activated, the code formatter preference page doesn't have the
preview feature. This feature requires that the formatter is capable of
formatting a code snippet and this is not possible yet.

The known limitations or defects are:
- line splitting needs to be improved. Right now in some cases, the line
splitting is quite confusing.
- cannot format any code snippet.

I won't be available for the next two weeks, so don't worry if your bug
reports are not updated soon.

Thanks,

Olivier Thomann



Back to the top