dev_arch.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. *dev_arch.txt* Nvim
  2. NVIM REFERENCE MANUAL
  3. How to develop Nvim, explanation of modules and subsystems *dev-arch*
  4. The top of each major module has (or should have) an overview in a comment at
  5. the top of its file. The purpose of this document is to give:
  6. 1. an overview of how it all fits together
  7. 2. how-to guides for common tasks such as:
  8. - deprecating public functions
  9. - adding a new public (API) function
  10. - adding a new public (UI) event
  11. 3. TODO: move src/nvim/README.md into this doc.
  12. Type |gO| to see the table of contents.
  13. ==============================================================================
  14. Data structures
  15. Use `kvec.h` for most lists. When you absolutely need a linked list, use
  16. `lib/queue_defs.h` which defines an "intrusive" linked list.
  17. ==============================================================================
  18. UI events
  19. The source files most directly involved with UI events are:
  20. 1. `src/nvim/ui.*`: calls handler functions of registered UI structs (independent from msgpack-rpc)
  21. 2. `src/nvim/api/ui.*`: forwards messages over msgpack-rpc to remote UIs.
  22. UI events are defined in `src/nvim/api/ui_events.in.h` , this file is not
  23. compiled directly, rather it parsed by
  24. `src/nvim/generators/gen_api_ui_events.lua` which autogenerates wrapper
  25. functions used by the source files above. It also generates metadata
  26. accessible as `api_info().ui_events`.
  27. See commit d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff for an example of adding
  28. a new UI event.
  29. UI events are deferred to UIs, which implies a deepcopy of the UI event data.
  30. Remember to bump NVIM_API_LEVEL if it wasn't already during this development
  31. cycle.
  32. Other references:
  33. * |msgpack-rpc|
  34. * |ui|
  35. * https://github.com/neovim/neovim/pull/3246
  36. * https://github.com/neovim/neovim/pull/18375
  37. * https://github.com/neovim/neovim/pull/21605
  38. ==============================================================================
  39. vim:tw=78:ts=8:sw=4:et:ft=help:norl: