aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/dev_arch.txt
blob: 1cb3b9ad6768b05363c3fed1cb2302d3598b1c14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
*dev_arch.txt*          Nvim


                            NVIM REFERENCE MANUAL


How to develop Nvim, explanation of modules and subsystems    *dev-arch*

The top of each major module has (or should have) an overview in a comment at
the top of its file. The purpose of this document is to give:

1. an overview of how it all fits together
2. how-to guides for common tasks such as:
    - deprecating public functions
    - adding a new public (API) function
    - adding a new public (UI) event
3. TODO: move src/nvim/README.md into this doc.

                                  Type |gO| to see the table of contents.

==============================================================================
Data structures

Use `kvec.h` for most lists. When you absolutely need a linked list, use
`lib/queue_defs.h` which defines an "intrusive" linked list.

==============================================================================
UI events

The source files most directly involved with UI events are:
1. `src/nvim/ui.*`: calls handler functions of registered UI structs (independent from msgpack-rpc)
2. `src/nvim/api/ui.*`: forwards messages over msgpack-rpc to remote UIs.

UI events are defined in `src/nvim/api/ui_events.in.h` , this file is not
compiled directly, rather it parsed by
`src/nvim/generators/gen_api_ui_events.lua` which autogenerates wrapper
functions used by the source files above. It also generates metadata
accessible as `api_info().ui_events`.

See commit d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff for an example of adding
a new UI event.

UI events are deferred to UIs, which implies a deepcopy of the UI event data.

Remember to bump NVIM_API_LEVEL if it wasn't already during this development
cycle.

Other references:
* |msgpack-rpc|
* |ui|
* https://github.com/neovim/neovim/pull/3246
* https://github.com/neovim/neovim/pull/18375
* https://github.com/neovim/neovim/pull/21605



==============================================================================

vim:tw=78:ts=8:sw=4:et:ft=help:norl: