ek9_add_capability

Answers with the edit that declares one gated-type capability in the 'capabilities <- [...]' List of a 'defines package' block, plus the resolved capability name.

Category: Editor · Compare: EK9 IDE - package-block right-click "Add Capability..." + the E12010 quick-fix. Concept: Android manifest permissions / iOS entitlements.

When to use it

'Declare that this package may use Stdout' is one call with file:'package.ek9' and capability:'Stdout'. The full 'org.ek9.lang::Stdout' is accepted too; this is the fix for E12010 UNDECLARED_CAPABILITY on a publishable package.

When not to use it

Details

capability is a gated type: the bare name ('TCP', 'Stdout', 'File') resolves to org.ek9.lang::<Name> and an associated type resolves to the capability that covers it (TCPConnection -> org.ek9.lang::TCP); the response's capability key is the spelling written. A bare name that is not a gated type is error 'unknown-capability' listing the pickable set; a missing package block is 'package-block-not-found'. The List is created in compact single-line form when absent - never as an empty '[]', which the grammar rejects. Enforcement (E12010, PRE_IR_CHECKS) applies only when publicAccess, version, license and capabilities are ALL declared; the dry run validates the identifier, it does not compile.

Arguments

ArgumentTypeRequiredWhat it is
capabilitystringyesThe gated type to permit: a bare name such as 'TCP' or 'Stdout' (resolved to org.ek9.lang::<Name>) or the fully-qualified 'org.ek9.lang::TCP'. A primary capability covers its group (TCP covers TCPConnection/TCPHandler/NetworkProperties), so the related types need no entry of their own.
filestringyesThe .ek9 file holding the 'defines package' block, workspace-relative (typically 'package.ek9'); an absolute path inside the workspace is accepted.

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. 3 of the 6 recorded are shown.

Add capability multi line

Request

{
  "capability" : "org.ek9.lang::TCP",
  "file" : "package.ek9"
}

Response

{
  "capability" : "org.ek9.lang::TCP",
  "conflicts" : [ ],
  "edits" : [ {
    "after" : "      \"org.ek9.lang::TCP\",",
    "endLine" : 10,
    "file" : "package.ek9",
    "startLine" : 10,
    "type" : "insert"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Added capability org.ek9.lang::TCP",
  "workspaceHash" : "<workspace-hash>",
...

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

Add capability creates list

Request

{
  "capability" : "org.ek9.lang::Stdout",
  "file" : "package.ek9"
}

Response

{
  "capability" : "org.ek9.lang::Stdout",
  "conflicts" : [ ],
  "edits" : [ {
    "after" : "\n    capabilities <- [\"org.ek9.lang::Stdout\"]",
    "endLine" : 9,
    "file" : "package.ek9",
    "startLine" : 9,
    "type" : "insert"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Created capabilities with org.ek9.lang::Stdout",
  "workspaceHash" : "<workspace-hash>",
...

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

Add capability bare name

Request

{
  "capability" : "Stdout",
  "file" : "package.ek9"
}

Response

{
  "capability" : "org.ek9.lang::Stdout",
  "conflicts" : [ ],
  "edits" : [ {
    "after" : "\n    capabilities <- [\"org.ek9.lang::Stdout\"]",
    "endLine" : 9,
    "file" : "package.ek9",
    "startLine" : 9,
    "type" : "insert"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "note" : "Resolved 'Stdout' -> 'org.ek9.lang::Stdout'",
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Created capabilities with org.ek9.lang::Stdout",
...

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

See also