Bug 471008

Summary: Allow to ignore editorconfig rules
Product: [Applications] kate Reporter: Íñigo <inigohuguet>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: christoph, waqar.17a
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Íñigo 2023-06-14 06:08:02 UTC
Kate supports parsing .editorconfig files to apply its formatting rules. However, this happens always there is an .editorconfig file present, and it is not possible to avoid it.

Although using the rules from .editorconfig is almost always the desired behaviour, there are some cases where this is not desired and deleting the file would be uncomfortable because it's part of the repository. To name a few:
- There are contributors of the project that don't like automatic formatting and want to do the formatting manually, or with different tools
- The file is added late, when the project already has lot of developed code, but the team doesn't want it to cause massive reformatting in old files that are not touched frequently

I think it should be possible to disable using editorconfig (and maybe also kateconfig) from settings.
Comment 1 Waqar Ahmed 2023-06-14 06:32:20 UTC
While this is trivially doable and has been asked before, I don't think we will do it. The file is put in a project so that its rules are followed by the code in project.
Comment 2 Íñigo 2023-06-14 10:19:47 UTC
Maybe this is not the best reason to convince you, but anyway is an additional reason: all other editors I know with editorconfig support (or any other formatting tool) allow not to use it, either it is opt-in or opt-out, either via plugins or builtin. I'm totally favourable to the opt-out approach: editorconfig enabled by default, but user can disable it.

It's true that the file is in the project, but maybe it's not by user choice, but because it's a repo used by many people and the file is added for convenience of the developers, but not enforcing its use. User freedom should prevail, and in any case it's the project owners' responsibility to enforce the formatting rules, not the editor chosen by each developer's responsibility.
Comment 3 Waqar Ahmed 2023-06-14 10:27:53 UTC
Ok, patches are welcome. This is easy to do so if you want to try, I can help.
Comment 4 Íñigo 2023-06-14 13:13:02 UTC
If nobody else is willing to do it, I can try, but then it can take lot of time. I have almost no free time lately, and I don't know KDE framework nor I am familiar at all wit the code base nor with the process to contribute. With your help I will try, but it will be very slow.
Comment 5 Waqar Ahmed 2023-06-15 07:48:28 UTC
We have infinite time and no deadlines ;)
Comment 6 Bug Janitor Service 2024-09-30 15:36:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/738
Comment 7 Christoph Cullmann 2024-10-04 16:36:59 UTC
Git commit 7e97a15452714d6de96e4e95c5bd5356955aa281 by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 04/10/2024 at 16:10.
Pushed by cullmann into branch 'master'.

Allow disabling editorconfig

M  +3    -0    src/dialogs/katedialogs.cpp
M  +7    -0    src/dialogs/opensaveconfigadvwidget.ui
M  +1    -1    src/document/katedocument.cpp
M  +2    -0    src/utils/kateconfig.cpp
M  +6    -1    src/utils/kateconfig.h

https://invent.kde.org/frameworks/ktexteditor/-/commit/7e97a15452714d6de96e4e95c5bd5356955aa281