universal-ctags / citre

A superior code reading & auto-completion tool with pluggable backends.
GNU General Public License v3.0
320 stars 26 forks source link

refactor: pluggable backend design #128

Closed AmaiKinono closed 1 year ago

AmaiKinono commented 2 years ago

The goal of this PR is to

  1. Separate the modules more clearly to ease the maintainence.
  2. Make it easy to create a backend so other tools like GNU Global or cscope could benefit from the UI of Citre.

The codebase is divided into 4 parts:

  1. Common Library: general utility functions. Including

    • citre-common-util.el: Helper functions of strings/files/processes...
    • citre-common-tag.el: The "tag" data structure and related functions.
  2. UI library: functions that shows and allows the user to interact with a set of tags. Including

    • citre-ui-jump.el
    • citre-ui-peek.el
  3. Frontend built on these 2 parts. Including

    • citre-backend-interface.el: Interface for defining a backend.
    • citre.el: User tools including commands, citre-mode, and capf/xref/imenu backend.
  4. Backends: Including

    • citre-tags.el: The "tags" backend, which uses readtags to read from a tags file.
    • citre-global.el: The GNU Global backend.

The "tags" backend is built on:

The tests are rearranged, and the Makefile target "test-common" tests the common library, and "test-tags", "test-global" test the backends. When testing the backends, the script checks if their dependencies exist. If not, it shows a warning and skip the tests, so #104 is closed.


TODOs: