Diffusion Kate 2aa7fd9b18af

Revive External Tools plugin

Authored by dhaumann on Jan 4 2019, 8:55 PM.


Revive External Tools plugin

This brings back the External Tools plugin that was removed with
commit 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.

Reviewers: cullmann, gregormi

Subscribers: kwrite-devel

Tags: Kate

Differential Revision: https://phabricator.kde.org/D17971


dhaumannJan 4 2019, 9:09 PM
Differential Revision
D17971: Revive External Tools plugin
R40:e4115f74cf9f: Add some FIXMEs