Skip to main content

Module stdlib_methods

Module stdlib_methods 

Source
Expand description

Stdlib type-method cache for completions.

At LSP completion time, let xs = [1, 2, 3]; xs. should surface Array.map / Array.filter / etc. — but those methods live in pure Shape source in stdlib-src/core/vec.shape (extend Vec<T>), not in the runtime MethodTable (which only carries universal methods like toString/type).

This module loads stdlib .shape modules once via ModuleLoader, extracts extend/impl methods via the same extract_type_methods used for user code, and exposes them as a process-wide cache keyed by the receiver type name (e.g. "Vec", "String", "HashMap", "Option", "Result"). The completion dispatcher merges this cache into the per-request impl_methods map, parallel to the existing imports::extension_type_methods() plumbing for extension .shape sources.

Lazy + cached via OnceLock: paid once per process, no recompute on every keystroke.

Functions§

stdlib_type_methods
Get stdlib type-methods, keyed by receiver type name.