https://bugs.kde.org/show_bug.cgi?id=442903

            Bug ID: 442903
           Summary: "kdevcustomscript||GNU_indent_GNU" is stored by
                    default if the user selects no source formatter
           Product: kdevplatform
           Version: git master
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: sourceformatter
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: igor...@gmail.com
  Target Milestone: ---

SUMMARY
In a new session, when the user navigates to Source Formatter tab of KDevelop
settings, doesn't change anything and presses the OK button, KDevelop stores
the following in this session's sessionrc (sans the x-python[3] entries when
kdev-python is not installed):

[SourceFormatter]
ModelinesEnabled=false
OverrideKateIndentation=false
text/x-c++hdr=kdevcustomscript||GNU_indent_GNU
text/x-c++src=kdevcustomscript||GNU_indent_GNU
text/x-chdr=kdevcustomscript||GNU_indent_GNU
text/x-csharp=kdevcustomscript||GNU_indent_GNU
text/x-csrc=kdevcustomscript||GNU_indent_GNU
text/x-java=kdevcustomscript||GNU_indent_GNU
text/x-objcsrc=kdevcustomscript||GNU_indent_GNU
text/x-python=kdevcustomscript||GNU_indent_GNU
text/x-python3=kdevcustomscript||GNU_indent_GNU

kdevcustomscript||GNU_indent_GNU is stored despite the fact that Artistic
Style||1TBS is initially selected in the UI for each language. The bug is
particularly glaring for Python[ 3] languages and x-python[3] MIME types: only
kdev-python's autopep8 style supports these languages and MIME types. The
Source Formatter configuration UI correctly shows autopep8 as the only style
applicable to the Python languages.

STEPS TO REPRODUCE
1. Create a new session in KDevelop.
2. (optional, if kdev-python is installed) Open a Python source file (*.py) so
that the Python languages are selectable in the Language combobox of the Source
Formatter settings tab.
3. Open the Source Formatter tab of KDevelop settings.
4. Click OK.
5. Quit KDevelop.
6. Locate the new session's sessionrc. For example like this:
    cd ~/.local/share/kdevelop/sessions
    grep -rI "<the new session's name>" .
7. Find the [SourceFormatter] section in the sessionrc file.

OBSERVED RESULT
See the [SourceFormatter] section in the SUMMARY of this bug report.

EXPECTED RESULT
1. autopep8 rather than GNU_indent_GNU should be autoconfigured for the Python
languages.

2. In this case the user has probably decided not to configure Source Formatter
at the moment. The simplest option is to store nothing in sessionrc. A more
user-friendly solution is to warn the user about the likely mistake and show
the formatters+styles selected for each language in a dialog. The dialog could
offer the following options/buttons:
  * go back to the configuration page;
  * don't change the configuration at all;
  * store the settings as "configured".
The dialog could also show a short help about the Source Formatter
configuration page to prevent issues like Bug 358798 (I was also thoroughly
confused by the UI at first). Plus the dialog could emphasize the importance of
configuring the right source formatter for each relevant language: not only it
is used by the Reformat Source/Line/Files actions, but also to format
auto-generated or auto-refactored or auto-fixed code.

SOFTWARE/OS VERSIONS
Manjaro GNU/Linux, Xfce
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2+kde+r222

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to