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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//! Zsh-compatible completion system (compsys)
//!
//! This module implements zsh's new completion system with full compatibility
//! for compadd, compset, zstyle, and all completion special parameters.
//!
//! # Architecture
//!
//! ## Default Mode (SQLite-backed)
//! - Cache: `~/.zshrs/compsys.db` (55MB with 16,872 function bodies)
//! - `compinit`: Parallel fpath scan with rayon, stores bodies in SQLite
//! - `autoload -Xz`: Instant lookup from SQLite (~2.7µs)
//! - No .zcompdump file created
//!
//! ## --zsh-compat Mode (Traditional)
//! - Cache: `~/.zcompdump` (761KB)
//! - `compinit`: Sequential scan, creates .zcompdump
//! - `autoload -Xz`: Scans fpath/zwc files (~70µs)
//! - Full zsh behavior for debugging/compatibility
//!
//! # Usage
//! ```text
//! // Default mode (recommended)
//! zshrs -c 'compinit'
//!
//! // Compat mode
//! zshrs --zsh-compat -c 'compinit'
//! ```
//!
//! Architecture based on analysis of:
//! - zsh Src/Zle/compcore.c, complete.c, computil.c
//! - fish src/complete.rs (for Rust patterns)
/// Canonical names of compsys-style completion functions (the
/// underscore-prefixed `_arguments` / `_files` / `_describe` / …)
/// that have native Rust implementations in this crate, so they
/// don't hit the slow shell-function autoload path.
///
/// Sources:
/// * Core dispatcher / completers: `base` (main_complete, normal,
/// dispatch, alternative, values, complete/ignored/approximate/
/// correct/expand/history/match/menu/prefix, description, message,
/// requested, wanted, all_labels, next_label, sep_parts)
/// * Arg-spec engine: `_arguments`
/// * Description rendering: `_describe` (in `computil`)
/// * File / path completers: `_files`, `_directories`,
/// `_path_files`, `_tilde_files`
/// * Per-command completers wired in `main`: `_git`, `_docker`,
/// `_cargo`, `_kubectl`, `_terraform`, plus `_ls` / `_cd` / `_cp`
/// / `_mv` / `_rm` / `_cat` / `_grep` baseline stubs.
///
/// Used by `lsp::dump_reflection_json` to populate the IntelliJ tool
/// window "Compsys" tab and by `lsp::dump_reference_html` for the
/// `ch-lsp-compsys` chapter in `docs/reference.html`. When a new `_*`
/// function gets a Rust impl, add it here (sorted) so it surfaces in
/// the inventory.
pub const COMPSYS_FN_NAMES: & = &;
// base.rs deleted — the type stubs (MainCompleteState /
// CompletionContext / CompleterResult / Value / CompleterFn) were
// never wired through the real engine ports. State flows through
// the shell-side param table via getsparam/setsparam directly; tag
// accounting goes through `bin_comptags` / `_tags` / `_requested`
// in `src/ported/zle/computil.rs` + `src/compsys/ported/Base/Core/`.
// builtin_bridge.rs deleted — middleman wrappers around bin_compadd/
// bin_zstyle/etc. Callers invoke `crate::ported::zle::complete::bin_*`,
// `crate::ported::modules::zutil::bin_*`, `lookupstyle`, `testforstyle`
// directly.
// completion.rs deleted — Completion/CompletionFlags/CompletionGroup
// are dups of Cmatch/Cmgroup types in src/ported/zle/comp_h.rs.
// menu.rs deleted — was a stub of what used to be a 3567-LOC dup of
// src/ported/zle/complist.rs.
// state.rs deleted — dup of shell parameter table for completion
// (PREFIX/SUFFIX/IPREFIX/ISUFFIX/QIPREFIX/QISUFFIX/CURRENT/words/
// compstate) ported in src/ported/zle/complete.rs + accessed via
// getsparam/setsparam/getiparam/setiparam from src/ported/params.rs.
// `zstyle.rs` (the () facade) deleted as middleman.
// Engine ports call `crate::ported::modules::zutil::lookupstyle`
// / `testforstyle` directly inline.
// Deleted shell-builtin dups: compadd, compset, computil, zstyle (in
// src/ported/zle/{complete,computil}.rs + src/ported/modules/zutil.rs),
// compcore + completion + matching (in src/ported/zle/{compcore,
// comp_h,compmatch}.rs), menu (in src/ported/zle/complist.rs),
// state (shell-side globals in src/ported/zle/compcore.rs), zle (in
// src/ported/zle/zle_*.rs). Callers route through the real
// `bin_*`/state in `crate::ported::*`.
// system.rs deleted — dup of completion-extension code that depended
// on the deleted Completion/CompletionReceiver types.
// base::{CompleterResult, BaseCompletionContext, MainCompleteState,
// Value} re-exports deleted alongside base.rs — those types were
// never load-bearing in any active engine port. Engine ports use
// shell-side state via getsparam/setsparam directly.
pub use ;
// completion::* re-exports removed alongside completion.rs deletion.
// Engine ports must use `crate::ported::zle::comp_h::{Cmatch, Cmgroup}`.
// state::* re-exports removed alongside state.rs deletion.
// menu::* re-exports removed alongside menu.rs deletion.
pub use ;