ek9_query_construct
Answers first: fieldNames, methodNames, operatorNames, defaultedOperatorNames, superName, traitNames, then construct{name, fullyQualifiedName, module, genus, isOpen, extends, traits, modifiers} and the full fields/methods/operators/constructors/metrics.
When to use it
Everything about one type or function in one call - fields, methods, operators, supertype, traits, metrics - with symbol:'Order', no file needed. An IDE cursor (file + line anywhere inside the construct) also works; defaulted operators are marked.
When not to use it
- JUST the effective member list (own + inherited + trait-provided), not the whole construct - use
ek9_query_effective_api. - You want the WHOLE module, not a single construct - use
ek9_query_module. - You have file + line + COLUMN and want the exact symbol at the cursor (parameter, local, …), finer than construct-level - use
ek9_inspect_symbol_at_cursor. - You want one method's call relationships, not the construct's structure - use
ek9_query_call_graph.
Details
ONE uniform shape for every genus: the name lists first, then the header under 'construct{}' (name, fullyQualifiedName, module, genus, modifiers, declaration 'line', isOpen, flat 'extends' + 'traits', generic template/parameterised-type info, 'serviceUri' for services) with sibling fields/methods/operators/constructors/metrics. A FUNCTION reuses that shape — parameters appear as 'fields', the return as a single 'methods' entry, operators/constructors empty. Metrics carry complexity/cohesion/coupling/inheritanceDepth plus member counts; 'coupling' MAY be fractional (each by-trait delegation discounts 0.5).
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
file | string | The EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site. | |
line | integer | 1-based line anywhere inside the target construct - OMIT it and pass symbol:'<name>' instead. | |
symbol | string | A construct NAME alone ('Shape', 'sample.deps.core::Validator') - no file needed, the tool finds it workspace-wide; or, with file (+ line), the identifier you mean there. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Construct shape
Request
{
"file" : "MyRecord.ek9",
"line" : 5
}
Response
{
"construct" : {
"extends" : "Any",
"fullyQualifiedName" : "com.example::MyRecord",
"genus" : "RECORD",
"isOpen" : false,
"line" : 5,
"modifiers" : [ ],
"module" : "com.example",
"name" : "MyRecord"
},
"constructors" : [ {
"parameters" : [ ]
} ],
"defaultedOperatorNames" : [ "?", "$", "$$", ":=:", "<=>", "==", "<>", "<", "<=", ">", ">=", "#?" ],
"fieldNames" : [ "name" ],
"fields" : [ {
"mutable" : true,
"name" : "name",
"type" : "String"
} ],
"meta" : {
"serverMs" : "<timing>"
},
...
Cut short here: 115 more lines. The whole recorded call.