ek9_query_functions
Answers first: status, functionCount, functionNames - complete for the workspace or the filters given - then functions[] {name, module, file, line, signature, parameters, returnType, isPure, isAbstract}.
When to use it
'Which free-standing functions exist, and is there one to reuse' is one call - no arguments, or nameFilter / returnTypeFilter / moduleFilter to narrow.
When not to use it
- methods bound to a class or trait, not free-standing functions (use
ek9_query_effective_apion the type, orek9_query_classes) - verbatim string match inside function bodies (use
ek9_search_text) - the full source of a function you already know the name of (use
ek9_read_construct)
Details
Top-level 'defines function' constructs only — anonymous dynamic-function closures are excluded (not name-addressable), and abstract function-typedefs (FUNCTION_TRAIT, higher-order parameter types) appear only with includeAbstract:true. nameFilter/returnTypeFilter are case-insensitive substrings, not regex; built-in org.ek9.* functions are excluded. A moduleFilter naming non-existent modules yields status:empty with meta.unmatchedFilters (informational, not an error); returnType is null for Void/no returning symbol, and unresolved types render <unresolved>.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
includeAbstract | boolean | Default false. When true, also includes abstract function-typedefs (higher-order parameter signatures). | |
includePure | boolean | Default true. When false, excludes functions marked 'as pure'. | |
moduleFilter | array of string | Restrict to specific modules (exact names). Default: workspace-wide. | |
nameFilter | string | Case-insensitive substring match on function names. | |
returnTypeFilter | string | Filter to functions whose return type matches (case-insensitive substring, e.g. 'Boolean' finds predicates). |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
List all
Request
{ }
Response
{
"functionCount" : 2,
"functionNames" : [ "isPositive", "greet" ],
"functions" : [ {
"file" : "util.ek9",
"isAbstract" : false,
"isPure" : true,
"line" : 6,
"module" : "com.example.util",
"name" : "isPositive",
"parameters" : [ {
"name" : "number",
"type" : "Integer"
} ],
"returnType" : "Boolean",
"signature" : "isPositive()\n -> number as Integer\n <- rtn as Boolean"
}, {
"file" : "util.ek9",
"isAbstract" : false,
"isPure" : false,
"line" : 10,
"module" : "com.example.util",
"name" : "greet",
"parameters" : [ {
...
Cut short here: 15 more lines. The whole recorded call.