ek9_remove_capability

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

Category: Editor · Compare: EK9 IDE - package-block right-click "Remove Capability...". Concept: Android manifest permission removal.

When to use it

'This package no longer needs TCP' is one call with file:'package.ek9' and capability:'TCP'. The full 'org.ek9.lang::TCP' is accepted too; revoke a declared capability the code stopped using.

When not to use it

Details

Preserves the List's single-/multi-line form. Removing the LAST entry is a real decision: an empty List literal is a parse error, so the whole declaration must go, and without a capabilities declaration the package is no longer publishable-enforced - hence the removeListIfEmpty gate (default false -> conflict 'would-empty-capabilities-list'). conflicts[].kind 'capability-not-declared' lists the existing entries. If the gated type is still used the next compile fires E12010 (no usage scan here); enforcement applies only to publishable packages (publicAccess + version + license + capabilities all declared).

Arguments

ArgumentTypeRequiredWhat it is
capabilitystringyesThe gated type to revoke: a bare name such as 'TCP' (resolved to org.ek9.lang::TCP) or the fully-qualified name - matched against the capabilities List entries.
filestringyesThe .ek9 file holding the 'defines package' block, workspace-relative (typically 'package.ek9'); an absolute path inside the workspace is accepted.
removeListIfEmptybooleanTrue allows removing the LAST entry, which drops the whole 'capabilities <- [...]' declaration (an empty List literal is a parse error) and switches capability enforcement off for the package. False (default) refuses that case with conflict 'would-empty-capabilities-list'.

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 5 recorded are shown.

Remove capability empties with flag

Request

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

Response

{
  "capability" : "org.ek9.lang::Stdout",
  "conflicts" : [ ],
  "edits" : [ {
    "before" : "    capabilities <- [\"org.ek9.lang::Stdout\"]",
    "endLine" : 9,
    "file" : "package.ek9",
    "startLine" : 9,
    "type" : "delete"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Removed org.ek9.lang::Stdout; removed now-empty capabilities declaration",
  "workspaceHash" : "<workspace-hash>",
...

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

Remove capability single line

Request

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

Response

{
  "capability" : "org.ek9.lang::File",
  "conflicts" : [ ],
  "edits" : [ {
    "after" : "    capabilities <- [\"org.ek9.lang::Stdout\"]",
    "before" : "    capabilities <- [\"org.ek9.lang::Stdout\", \"org.ek9.lang::File\"]",
    "endLine" : 9,
    "file" : "package.ek9",
    "startLine" : 9,
    "type" : "replace"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Removed capability org.ek9.lang::File",
...

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

Remove capability apply

Request

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

Response

{
  "capability" : "org.ek9.lang::File",
  "conflicts" : [ ],
  "edits" : [ {
    "before" : "      \"org.ek9.lang::File\"",
    "endLine" : 11,
    "file" : "package.ek9",
    "startLine" : 11,
    "type" : "delete"
  }, {
    "after" : "      \"org.ek9.lang::Stdout\"",
    "before" : "      \"org.ek9.lang::Stdout\",",
    "endLine" : 10,
    "file" : "package.ek9",
    "startLine" : 10,
    "type" : "replace"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
...

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

See also