citre
citre copied to clipboard
refactor: pluggable backend design
The goal of this PR is to
- Separate the modules more clearly to ease the maintainence.
- 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:
-
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.
-
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
-
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.
-
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:
- citre-readtags.el: The readtags program interface.
- citre-ctags.el: Finding & generating tags files.
- citre-lang-*.el: Language supports.
- citre-tags.el: The backend definition and language support framework.
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:
- [x] It's good time to review the naming of all identifiers.
- [ ]
citre-diagnostic
which prints diagnostic information. - [ ] Rethink
citre-auto-enable-citre-mode
(How do we support multiple backends that have different capabilities?) - [ ] Improve the GNU Global backend.
- [ ] Update documents & commentaries.
- [ ] modify the CI in uctags repo to only test the tags backend after merge this.