ek9_remove_field

Deletes a field from a class/record/component; answers status and edits[] (one DELETE), or conflicts[] with every in-body reference classified by 'kind' and a suggestedRepair for the mechanical ones.

Category: Editor · Compare: Refactor → Safe Delete (IntelliJ, field scope)

When to use it

'Remove the field spare from Greeter' is one call with symbol:'Greeter.spare' - no file or line needed. Use it when a class/record/component field is dead, redundant or being collapsed; the tool walks the owning construct's body and deletes it or reports the blocking reference sites.

When not to use it

Details

Each conflict carries a 'kind': boolean-chain-term / format-string-interpolation / constructor-param are mechanically repairable (constructor-param repairs cascade to callers in other files); expression-operand is the ESCALATION kind — semantics change, ask the human. The server re-walks the construct body on every call, so re-call after repairs rather than self-judging completion; there is no force flag — the conflicts list dominates. Default operators on the construct (<=>, ?, $, #?, ...) never block removal but surface a wouldAutoDerive[] note — derived identity/equality/string form shifts silently, so warn the human.

Arguments

ArgumentTypeRequiredWhat it is
filestringThe EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site.
memberNamestringField to remove. Must exist on the construct (omit when symbol is 'Type.field').
symbolstringyesThe construct that owns the field ('Greeter'), or the field itself as 'Greeter.spare' (then memberName may be omitted) - found workspace-wide, no file needed.

It also takes the arguments every tool takes.

Recorded calls

Real calls, recorded against small projects and checked on every build - a changed answer fails it.

Remove unreferenced field apply

Request

{
  "constructName" : "Greeter",
  "fieldName" : "spare",
  "file" : "Greeter.ek9"
}

Response

{
  "conflicts" : [ ],
  "edits" : [ {
    "before" : "      spare as Integer: 0",
    "endLine" : 7,
    "file" : "Greeter.ek9",
    "startLine" : 7,
    "type" : "delete"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Removed spare from Greeter (1 edit)",
  "workspaceHash" : "<workspace-hash>",
  "wouldBeDiagnostics" : [ ],
...

Cut short here: 2 more lines. The whole recorded call.

See also