Revision d3994b5...

Go back to digest for 16th February 2014

Features in Development Tools

Sven Brauch committed changes in [kdevplatform] /:

Allow language plugins to provide styles to formatters

REVIEW:115590
This is a binary-incompatible change; relink kdevelop and all
language plugins or you will get crashes.
The basic is to shift the philosophy of source formatters a bit: instead
of providing integration with one fixed tool with many slightly
different configurations, a Source Formatter plugin can provide an
engine for source formatters which can do very different things
depending on the configuration. For many languages (I obviously have
python in mind) tools already exist which re-format source code and just
need to be called. Writing a new formatter plugin for each of those
would basically duplicate the existing functionality (especially from
the customscript formatter) for each language.

Thus, this patch provides a new virtual function in ILanguageSupport
which allows language plugins to return any amount of formatting
configurations for any source formatter plugin (the formatter plugin
choses which of the items it accepts based on a name).

To make this useful, the mime type and language, and -- optionally -- a
text sample different from the default are now stored inside the
formatting configuration items. The list of displayed configurations is
filtered by language. Only formatting engines which support at least one
configuration for a selected language are shown (as before), but this is
now "dynamic" and depends on the loaded language plugins (it's no longer
hardcoded in the .desktop file).

File Changes

Modified 9 files
  •   interfaces/isourceformatter.cpp
  •   interfaces/isourceformatter.h
  •   shell/sourceformattercontroller.cpp
  •   shell/sourceformattercontroller.h
  •   language/interfaces/ilanguagesupport.cpp
  •   language/interfaces/ilanguagesupport.h
  •   shell/settings/editstyledialog.cpp
  •   shell/settings/sourceformattersettings.cpp
  •   shell/settings/sourceformattersettings.h
9 files changed in total