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

--- Comment #17 from Igor Kushnir <igor...@gmail.com> ---
I confirm the issue. The pasting issue is probably of the same origin, seeing
as it comes from the KTextEditor configuration common to KDevelop, Kate and
KWrite. The *Override Kate Indentation Mode* checkbox should ideally prevent
this issue. But currently this checkbox only affects tabs/spaces and
indentation width:
https://invent.kde.org/kdevelop/kdevelop/-/blob/4ffbedc9e97bb84bb242ad5f7b76b6a7153b5a4d/kdevplatform/shell/sourceformattercontroller.cpp#L654.
The thing is, the underlying KTextEditor framework has its own formatting,
which KDevelop needs to override. The KTextEditor formatting configuration is
not as sophisticated as KDevelop's one.

You can try to improve the situation by changing the default indentation mode
on the Editing->Indentation tab or configuring formatting on the
Open/Save->Modes & Filetypes tab: use the Variables line edit and the
Indentation mode combobox to configure KTextEditor's formatting for each
Filetype you use. See the documentation:
https://kate-editor.org/2006/02/09/kate-modelines/ Unfortunately this
configuration is system-wide, applies to all files and not only in KDevelop,
but in Kate and KWrite too. Consider also
https://kate-editor.org/2006/02/09/kateconfig-files/

If you manage to work around this bug by configuring KTextEditor, consider
contributing improvements to the adaptEditorIndentationMode() function I have
linked. This way KDevelop's per-session or per-project formatting configuration
would automatically override more KTextEditor formatting options. Though I
expect that making your workaround generally useful could prove to be a
challenging and time-consuming task, because the current formatting
configuration has to be extracted from various source formatters before it can
be applied to KTextEditor.

Another potential fix in KDevelop is intercepting KTextEditor's formatting
action (such as unindenting the protected: label) and reformatting the affected
source code range with KDevelop's formatter instead (or reformat after each
KTextEditor's formatting action).

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

Reply via email to