Expand description
Extract PL/pgSQL function parameters and DECLARE’d locals from the buffer text so completion can surface them inside a function body.
Approach: walk backwards from offset to the most recent
CREATE [OR REPLACE] FUNCTION|PROCEDURE <name> (...) header. Parse
its parameter list, then continue forward to find any DECLARE ... BEGIN
blocks before the cursor. Both contribute completion items.
Structs§
Functions§
- extract
- Scan the buffer for the function header that encloses
offset. When the cursor sits outside any function the returned struct is empty. - push_
items - Push
Localsas completion items. - type_of
- Look up the declared type of a PL/pgSQL local by name. Searches
parameters first, then DECLARE’d locals. Case-insensitive match.
Returns the raw type string (
users,INT,promo_codes%ROWTYPE, etc.) so callers can decide what to do with it.