<table><tr><td style="">dhaumann created this revision.<br />dhaumann added reviewers: cullmann, gregormi.<br />Herald added a project: Kate.<br />Herald added a subscriber: kwrite-devel.<br />dhaumann requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D17971">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This brings back the External Tools plugin that was removed with<br />
commit <a href="https://phabricator.kde.org/R40:e443c58df03e9fb8f26b67e86852f708d097517a" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">e443c58df03e9fb8f26b67e86852f708d097517a</a> for KDE 4.8.</p>

<p>Revival is motivated by the fact that we seem to add more and more<br />
tools in context menus which not always makes sense (e.g. having<br />
lots of hard-coded git tools in the Projects plugin). It makes<br />
more sense to e.g. enable launching git-cola as external tool,<br />
which was also used for testing: git-cola -r %directory</p>

<p>The code is still old, and as such or rather low quality. There<br />
are ugly casts from parent()->parent() to some magic widget type,<br />
some strange connects in the plugin handling etc.</p>

<p>All in all, this is just a work-in-progress state such that you<br />
can play around with it, and that we can discuss where we want to<br />
go with this plugin.</p>

<p>Currently, the contents of the "Scripts:" multiline edit is<br />
executed in a shell environment /bin/sh. While this is quite<br />
flexible, we definitely also lack several features, namely:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">we cannot replace selected text (think of clang-format)</li>
<li class="remarkup-list-item">we cannot use e.g. /bin/python or other interpreters</li>
<li class="remarkup-list-item">the KTextEditor::Command integration is broken, since the KTextEditor::Command registers itself on creation, which is a point in time where we currently do not know the commands yet. This needs refactoring to work in a different way.</li>
<li class="remarkup-list-item">Saving and loading is done via KConfig. We may want to use some json-based solution instead nowadays.</li>
<li class="remarkup-list-item">There are no default external tools.</li>
</ul>

<p>More features that come to my mind:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Redirect output of external tool into editor</li>
<li class="remarkup-list-item">Redirect output of external tool into a toolview / sidebar</li>
<li class="remarkup-list-item">Make %project available in the macro expander, if the Projects plugin is loaded</li>
<li class="remarkup-list-item">launch external tool in a new embedded terminal</li>
<li class="remarkup-list-item">assigning shortcuts works, but only in a two-step approach, i.e. first create the tool, then go to the shortcuts editor dialog.</li>
<li class="remarkup-list-item">syntax highlighting in the "Scripts:" multiline edit</li>
<li class="remarkup-list-item">currently, since we allow arbitrary scripts, we cannot check whether a tool is really available and then hide or disable it.</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R40 Kate</div></div></div><br /><div><strong>BRANCH</strong><div><div>revive-externaltools-plugin</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17971">https://phabricator.kde.org/D17971</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>addons/CMakeLists.txt<br />
addons/externaltools/CMakeLists.txt<br />
addons/externaltools/Messages.sh<br />
addons/externaltools/configwidget.ui<br />
addons/externaltools/externaltools<br />
addons/externaltools/externaltools.cpp<br />
addons/externaltools/externaltools.h<br />
addons/externaltools/externaltoolsplugin.cpp<br />
addons/externaltools/externaltoolsplugin.desktop<br />
addons/externaltools/externaltoolsplugin.h<br />
addons/externaltools/plugin.qrc<br />
addons/externaltools/ui.rc</div></div></div><br /><div><strong>To: </strong>dhaumann, cullmann, gregormi<br /><strong>Cc: </strong>kwrite-devel, hase, michaelh, ngraham, demsking, cullmann, sars, dhaumann<br /></div>