KDevelop editor interfaces
Matthias Hoelzer-Kluepfel
mhk at caldera.de
Sun Apr 22 13:54:02 UTC 2001
Hi all,
for the last couple of days, I have been thinking about how to
improve the editor interface used in KDevelop. The main reason
was that I love writing kdevelop parts, but while writing the
konsole and the astyle part, I noticed that even for simple
tasks, a part has to 'talk' to the editor. And currently, this
means to refer to a lot of internals of the specific editor
implementation used by kdevelop.
Unfortunately, a simple generic interface like KTextEditor
seems not enough for the tight integration you need inside
KDevelop. I talked to some people about that problem (Simon
Hausmann and Cornelius Schumacher, to be precise), and we
discussed several proposals how to find a usefull, but still
managable interface.
There are two main challenges in designing this interfaces:
a) It should be easy to make an editor implement the interface
b) It should be easy to use an editor based on the interface
Of course, Simon and Cornelius found a nice solution that was
much better than my proposals, so I trashed mine and adopted
theirs :-)
The solution we came up with is that we need a modular
interface that is extensible. This means that an actual
implementation of an editor implements a basic interface
as well as an arbitrary number of additional interfaces with
advanced functions. Of course, not every implementation would
have to support all interfaces.
The user of the interface would then be able to use the basic
interface to query for the advanced interfaces the
implementation supports, and can act accordingly. For example,
a kwrite/kate based implementation might offer the
"BreakpointInterface", while a kfte based implementation might
not. This would mean that using kfte, you would loose the
possibility to set a breakpoint right in the editor, but you
could still use all the other functions provided by kfte.
Ok, that's the theory. In practice, it is quite hard to find
the right interfaces, and so I just started with the most
basic ones. I defined a small set of them, wrote a very simple
implementation (usigin qmultilineedits :), a test program and
even started to hack support into kdevelop. It is not more
than a proof-of-concept, but it is ok for a start.
Before I go on, I would like to discuss these ideas with
everyone interested. I will commit the code I already have
(without the integration into KDevelop, to not break anything)
soon. If you think that is a sensible way to go on, I would
then try to port the kwrite used in kdevelop to the new
interface and switch to the new interface internally. If you
don't like it, well, then we have to make it better :)
Comments?
Bye,
Matthias.
-
to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«
More information about the KDevelop-devel
mailing list