diff options
| author | David Moc <personal@cdatgoose.org> | 2026-06-02 14:15:25 +0200 |
|---|---|---|
| committer | David Moc <personal@cdatgoose.org> | 2026-06-02 14:15:25 +0200 |
| commit | b68766967c86a6a789d65772f69f7f44939ebdf2 (patch) | |
| tree | c65d5a929931d9d52b5717f6577a876d73e66491 /docs | |
| parent | a15cb041654ae307add0b998b526c87c3f42bf5f (diff) | |
Add API completion signatures
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ccdjit-improvements.md | 7 | ||||
| -rw-r--r-- | docs/plugin-api.md | 14 |
2 files changed, 16 insertions, 5 deletions
diff --git a/docs/ccdjit-improvements.md b/docs/ccdjit-improvements.md index 4b48589..ef4469e 100644 --- a/docs/ccdjit-improvements.md +++ b/docs/ccdjit-improvements.md @@ -37,9 +37,10 @@ currently favors integer-only plugin helpers, host-owned objects, and copy-based text because those paths are predictable. Static completion lists should use `ecex_define_word_completion_provider` plus -`ecex_completion_provider_add_words`. That passes one string literal blob over -the host boundary and avoids depending on JIT-side `const char *` array -indexing. +`ecex_completion_provider_add_words`, or `ecex_completion_provider_add_entries` +when each candidate needs its own signature/detail. Both forms pass one string +literal blob over the host boundary and avoid depending on JIT-side +`const char *` array indexing. Runtime plugin callbacks should avoid variadic C library calls such as `snprintf`. Build strings with fixed-arity helpers or host APIs instead; the C diff --git a/docs/plugin-api.md b/docs/plugin-api.md index 04851ed..76051f9 100644 --- a/docs/plugin-api.md +++ b/docs/plugin-api.md @@ -221,14 +221,24 @@ ecex_completion_provider_set_detail(ed, "demo-words", "C runtime symbol"); `ecex_completion_provider_add_words` accepts a whitespace-separated string literal, copies the words on the host, and avoids depending on JIT string-array indexing. Provider details are optional minibuffer labels shown while cycling. +Use `ecex_completion_provider_add_word_detail` for one word with its own label, +or `ecex_completion_provider_add_entries` for newline-separated entries in +`word<TAB>detail` form: + +```c +ecex_completion_provider_add_entries(ed, + "demo-words", + "malloc\tvoid *malloc(size_t size)\n" + "free\tvoid free(void *ptr)\n"); +``` The built-in `indent-for-tab-command` is bound to `TAB`; `config/c_mode_plugin.c` defines `c-mode`, overrides `TAB` with `c-indent-line`, registers C-family file handlers, and adds clangd completion when `clangd` is installed. Clangd completions use label details when available, so functions display signatures and return types. `config/ecex_api_completion_plugin.c` is the `ecex-mode` -plugin; it registers global ecex API completions and special-cases `ed->` field -names using word completion providers. +plugin; it registers global ecex API completions with signature details and +special-cases `ed->` field names using typed word completion entries. ```c ecex_add_clangd_completion_provider(ed, "c-mode-clangd", "c-mode"); |
