Re: [Builder] Search and replace - reusable frontend



On Sat, Jun 04, 2016 at 11:21:14AM -0700, Christian Hergert wrote:
Being able to share these with Gedit is definitely a goal of ours. Like
most of our upstream work has gone in the last couple years, I imagine
we'll prototype first (which Matthew Leeds will be working on it), and
then look to see how it can be abstracted into GSV (or alternatively the
new library you've been starting for editors built on GSV).

Yes, re-use it in gedit, gCSVedit and company.

The new library, Gtef, would indeed be a good place since it can serve
as an incubator for GSV.

We do intend to build the project-wide search/replace API on top of a
simple refactoring engine, but I don't think it will be all that
complex. I'm assuming something simple like:

  RefactoryCommand {
    gboolean (*do)       (RefactoryCommand *, GError **error);
    gboolean (*undo)     (RefactoryCommand *, GError **error);
    gboolean (*can_undo) (RefactoryCommand *);
    gboolean (*can_redo) (RefactoryCommand *);
    gchar   *(*get_label)(RefactoryCommand *);

    /* this allows us to push multiple items on the stack but
     * undo them as a single operation.
     */
    gboolean (*chain)    (RefactoryCommand *, RefactoryCommand *next);
  }

Which is basically just your typical undo/redo stack item (although
we'll likely need them to be async).

I envision things like F2 to rename variables/symbols/classes will
create a command like this and do refactory_engine.run(command)

For code reuse, the first step would be to take just the single-document
search and replace. That alone would be awesome. But of course the
project-wide search and replace would be useful too, but I guess it is
more complicated to make it libide-independent.

Anyway, I'm looking forward to Matthew's work!

--
Sébastien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]