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}.

Category: Enquiry · Compare: Functions outline panel (reuse-discovery)

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

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

ArgumentTypeRequiredWhat it is
includeAbstractbooleanDefault false. When true, also includes abstract function-typedefs (higher-order parameter signatures).
includePurebooleanDefault true. When false, excludes functions marked 'as pure'.
moduleFilterarray of stringRestrict to specific modules (exact names). Default: workspace-wide.
nameFilterstringCase-insensitive substring match on function names.
returnTypeFilterstringFilter 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.