Bug 502788

Summary: Kate build plugin should support placeholders in run cmds
Product: [Applications] kate Reporter: Räuber Mank <h2vt5gemy>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: christoph, kare.sars
Priority: NOR    
Version First Reported In: 24.12.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Räuber Mank 2025-04-14 12:10:23 UTC
SUMMARY
Placeholders (%f, %d, %n) in run commands of build targets do not get substituted like in build commands.

STEPS TO REPRODUCE
1. Activate build plugin
2. Open the tool view for build
3. Create a target
4. Add a run command with placeholders (e.g. python %f)
5. Run the target

OBSERVED RESULT
Placeholders %f, %d and %n do not get substituted with the current file path, working directory or filename, respectively.

EXPECTED RESULT
Placeholders in run commands should be replaced like in build commands.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.12.0
Qt Version: 6.9.0
Kernel Version: 6.14.2-arch1-1 (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Link to substitution in build function: https://invent.kde.org/utilities/kate/-/blob/e2b4ffccb9a695b69a49680add5cae41754ad109/addons/katebuild-plugin/plugin_katebuild.cpp#L1098
Link to run-after-build function, where subsitution is missing: https://invent.kde.org/utilities/kate/-/blob/e2b4ffccb9a695b69a49680add5cae41754ad109/addons/katebuild-plugin/plugin_katebuild.cpp#L1428
Comment 1 Christoph Cullmann 2025-05-30 19:16:32 UTC
True, I guess best would be to expand that at the same place to avoid that happens on the fly on completion, when one might have switched the document.

Patches welcome :)
Comment 2 Bug Janitor Service 2025-06-10 23:23:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1791
Comment 3 Christoph Cullmann 2025-06-14 15:33:33 UTC
Can you test

https://invent.kde.org/utilities/kate/-/merge_requests/1791

?
Comment 4 Christoph Cullmann 2025-06-15 15:49:20 UTC
Git commit cd2a282b1bef8f718b801c8e87f495e6f08e79b8 by Christoph Cullmann, on behalf of Kåre Särs.
Committed on 15/06/2025 at 15:45.
Pushed by cullmann into branch 'master'.

Build: Add substitution support to run commands

M  +7    -1    addons/katebuild-plugin/TargetHtmlDelegate.cpp
M  +42   -12   addons/katebuild-plugin/plugin_katebuild.cpp
M  +7    -3    addons/katebuild-plugin/plugin_katebuild.h

https://invent.kde.org/utilities/kate/-/commit/cd2a282b1bef8f718b801c8e87f495e6f08e79b8