You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,36 @@ Again, only documenting the differences:
72
72
2. Like `commandt.file_finder()`, this function doesn't do anything special with config; it just forwards `options`.
73
73
3. Unlike `commandt.file_finder()`, we don't `pushd`, and we don't pass in an `on_close` that does `popd` either, because watchman doesn't need to change directory to do its job. However, it _does_ require us to pass an `on_open()` that does the `relativize()` trick.
74
74
75
+
## Summary of finder life-cycles
76
+
77
+
| Command | Argument? | Finder function | Variant | Mode | Context? |`on_directory`? |`pushd`? |`on_close`/`popd`? |
|`:CommandTSearch`| none |`finder`| list | 'virtual' | no | no | no | no |
90
+
|`:CommandTTag`| none |`finder`| list | 'virtual' | yes | no | no | no |
91
+
|`:CommandTWatchman`| directory |`watchman_finder`| n/a | 'file' | no | no | no | no |
92
+
|`:CommandT`| directory |`file_finder`| n/a | 'file' | no | no | yes | yes |
93
+
94
+
Legend:
95
+
96
+
- Argument?: Does the commmand accept an argument?
97
+
- Finder function: What is the `commandt` function that serves as entry point?
98
+
- Variant: Does the finder use a list scanner (ie. `candidates`) or a command scanner (ie. `command`)?
99
+
- Mode: Is the finder a "file" finder (shows icons) or a "virtual" one?
100
+
- Context?: Does the finder make use of the `context` parameter to pass state?
101
+
-`on_directory`?: Does the finder use an `on_directory` callback to infer a starting directory if appropriate?
102
+
-`pushd`?: Does the finder use `pushd()` before scanning?
103
+
-`on_close`/`popd`?: Does the finder use an `on_close` callback and `popd` to go back to the previous directory when closing its UI (and optionally opening a selection)?
104
+
75
105
# Memory model
76
106
77
107
For maximum performance, Command-T takes great pains to avoid unnecessary copying. This, combined with the fact that memory is passing across Lua's FFI boundary to and from C code, means that there are some subtleties to the question of which code owns any particular piece of memory, and who is responsible for freeing it (either manually from the C code, or automatically via garbage collection initiated on the Lua side).
0 commit comments