D17971: Revive External Tools plugin
noreply at phabricator.kde.org
Fri Jan 4 21:09:41 GMT 2019
dhaumann created this revision.
dhaumann added reviewers: cullmann, gregormi.
Herald added a project: Kate.
Herald added a subscriber: kwrite-devel.
dhaumann requested review of this revision.
This brings back the External Tools plugin that was removed with
commit e443c58df03e9fb8f26b67e86852f708d097517a <https://phabricator.kde.org/R40:e443c58df03e9fb8f26b67e86852f708d097517a> for KDE 4.8.
Revival is motivated by the fact that we seem to add more and more
tools in context menus which not always makes sense (e.g. having
lots of hard-coded git tools in the Projects plugin). It makes
more sense to e.g. enable launching git-cola as external tool,
which was also used for testing: git-cola -r %directory
The code is still old, and as such or rather low quality. There
are ugly casts from parent()->parent() to some magic widget type,
some strange connects in the plugin handling etc.
All in all, this is just a work-in-progress state such that you
can play around with it, and that we can discuss where we want to
go with this plugin.
Currently, the contents of the "Scripts:" multiline edit is
executed in a shell environment /bin/sh. While this is quite
flexible, we definitely also lack several features, namely:
- we cannot replace selected text (think of clang-format)
- we cannot use e.g. /bin/python or other interpreters
- 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.
- Saving and loading is done via KConfig. We may want to use some json-based solution instead nowadays.
- There are no default external tools.
More features that come to my mind:
- Redirect output of external tool into editor
- Redirect output of external tool into a toolview / sidebar
- Make %project available in the macro expander, if the Projects plugin is loaded
- launch external tool in a new embedded terminal
- assigning shortcuts works, but only in a two-step approach, i.e. first create the tool, then go to the shortcuts editor dialog.
- syntax highlighting in the "Scripts:" multiline edit
- currently, since we allow arbitrary scripts, we cannot check whether a tool is really available and then hide or disable it.
To: dhaumann, cullmann, gregormi
Cc: kwrite-devel, hase, michaelh, ngraham, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KWrite-Devel