Bug 444645 - Need to be able to specify indentation settings by project
Summary: Need to be able to specify indentation settings by project
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: All editors (show other bugs)
Version: 5.6.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2021-10-30 05:49 UTC by Aaron Williams
Modified: 2021-10-30 11:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Williams 2021-10-30 05:49:49 UTC
Right now the only way to configure indentation is in the global settings.  This should be on a per-project basis. For example, I deal with multiple projects, often open at the same time in different KDevelop sessions. Some projects use the Linux kernel indentation with 8 space tabs whereas others use 4 spaces and don't use tabs.

Adding Kate mode lines is also not acceptable in many cases.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Igor Kushnir 2021-10-30 08:19:15 UTC
You can configure source formatter in project settings. Enable the Override editor indentation mode option there. But if you select Custom Script Formatter, this might not work right away. If so, check if merging https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/273 makes it work.
Comment 2 Aaron Williams 2021-10-30 11:09:42 UTC
I am using custom indentation settings for several of my projects. There are also variations on using tabs vs spaces which seems to only be set in the global editor indentation settings.
Comment 3 Igor Kushnir 2021-10-30 11:33:42 UTC
1. Right click on a project in Projects tool view.
2. Switch to the Source Formatter tab.
3. Uncheck the Use default checkbox.
4. Check the Override editor indentation mode checkbox.
5. Select a formatter and a style for each language you use (e.g. C, C++, note that *.h files are always treated as C). If none of the predefined styles suites your needs, create your own. Tabs vs spaces and their widths can be configured in KDevelop's Artistic Style visual editor and in configuration files or command line options to custom scripts (e.g. GNU Indent, Clang Format, uncrustify).

You can also configure source formatters on per-session rather than per-project basis in main menu => Settings => Configure KDevelop... => Source Formatter.
Comment 4 Igor Kushnir 2021-10-30 11:37:43 UTC
Sorry, missed one step:
> 1. Right click on a project in Projects tool view.
1.5. Click Open Configuration...
> 2. Switch to the Source Formatter tab.