[Feature] Enable per-project setting of source formatters
ClosedPublic

Authored by kossebau on Jul 25 2017, 10:18 PM.

Details

Summary

Patch adds a plugin kdevsourceformatter, as currently needed
to provide some per-project config pages. To ensure it is
always available, "X-KDevelop-LoadMode": "AlwaysOn" is set.
This plugin then provides the per-project config page
for source formatters.

To reuse the code for selecting, editing, creating & deleting
formatters, the respective code is factored out from
the class KDevelop::SourceFormatterSettings
into a new (exported) class KDevelop::SourceFormatterSelectionEdit,
which is then used both from the global and the project config page.

To enable the SourceFormarController instance to take the per-project
settings into account, the API of ISourceFormatterController is
changed to always include the url of the object, so the project
it belongs to can be estimated.

Test Plan

Changes to per-project settings are properly saved and restored in
the UI.
Source format controller takes settings of project into account
if configured to do, both for snippets/line and whole files.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Jul 25 2017, 10:18 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJul 25 2017, 10:18 PM

Project config:

Global config (should be no changes):

kossebau updated this revision to Diff 17342.Jul 28 2017, 10:14 PM

update to latest master

kossebau updated this revision to Diff 17468.Aug 1 2017, 4:07 AM

update to latest master

kossebau updated this revision to Diff 17740.Aug 5 2017, 2:43 AM

update to latest master

kfunk accepted this revision.Aug 5 2017, 8:57 AM
kfunk added a subscriber: kfunk.

Rest LGTM. Feel free to commit after fixing up; no need for another review round.

plugins/sourceformatter/config/projectconfigpage.ui
23

Just use a check box instead?

So this gets a: [ ] Use default instead of Use default: [ ]

plugins/sourceformatter/kdevsourceformatter.json
6

Description should be provided; it's for the Loaded Plugins dialog.

shell/sourceformatterselectionedit.h
3

Minor: Indentation/style looks a bit odd in the license header.

54

In order to make this a proper pimpl'd class you need to remove the private symbols as well. Can be done in a separate commit though

68

Minor: QScopedPointer? :)

This revision is now accepted and ready to land.Aug 5 2017, 8:57 AM
kossebau marked 4 inline comments as done.Aug 5 2017, 3:41 PM

@kfunk Thanks for review!

shell/sourceformatterselectionedit.h
3

Tried to keep changes small by doing a plain copy of original one.
Perhaps given this is a new file, even if forked, might be a reason to apply usual style, doing that now.

54

Would do in separate commit. Actually when doing the d-pimpl cleanup I saw more of such private things in the API and learned I have no clue if this is okay or not. Will poke you/people on irc for some discussion the next days.

This revision was automatically updated to reflect the committed changes.
kossebau marked an inline comment as done.