ek9_toggle_block_comment
Wraps a whole-line range in EK9 block-comment markers (<!- ... -!>) or removes them when the range already carries them, never nesting; answers status and edits[] (two INSERTs or two DELETEs).
When to use it
'Comment out lines 42-50 of orders.ek9' is one call with file, startLine:42, endLine:50; re-select INCLUDING the marker lines to uncomment. Use it to TEMPORARILY exclude whole lines from compilation - debug bisection, staged rollout, scratch code.
When not to use it
- PERMANENTLY removing a construct - use
ek9_safe_delete(commenting-out is wrong unless truly temporary). - Commenting a single line or a partial line — use a // line comment via
ek9_edit_file; this tool wraps WHOLE lines only.
Details
Wraps whole lines startLine..endLine in the EK9-distinctive <!- … -!> form (not the HTML <!-- … --> nor the reserved documentation <?- … -?>), each marker on its own line indented to match the first line of the range. Refuses to nest: if any line in the range begins with a marker from any of the three block-comment forms it returns status:error ('Cannot comment: line N contains a block comment marker'); // line comments inside the range are fine. Invalid range (endLine<startLine, startLine<1, or endLine past EOF) returns status:error 'Invalid line range: S-E'.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
endLine | integer | yes | Last line of the range to toggle (1-based, inclusive). Must be >= startLine. |
file | string | yes | Workspace-relative path to the .ek9 source file. |
startLine | integer | yes | First line of the range to toggle (1-based, inclusive). |
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.
Toggle on apply
Request
{
"endLine" : 8,
"file" : "Hello.ek9",
"startLine" : 8
}
Response
{
"conflicts" : [ ],
"edits" : [ {
"after" : " -!>",
"endLine" : 9,
"file" : "Hello.ek9",
"startLine" : 9,
"type" : "insert"
}, {
"after" : " <!-",
"endLine" : 8,
"file" : "Hello.ek9",
"startLine" : 8,
"type" : "insert"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"resolvedPath" : "<workspace-root>/Hello.ek9",
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 1,
"lineCount" : 2,
...
Cut short here: 9 more lines. The whole recorded call.
Toggle off round trip
Request
{
"endLine" : 8,
"file" : "Hello.ek9",
"startLine" : 8
}
Response
{
"conflicts" : [ ],
"edits" : [ {
"before" : " -!>",
"endLine" : 10,
"file" : "Hello.ek9",
"startLine" : 10,
"type" : "delete"
}, {
"before" : " <!-",
"endLine" : 8,
"file" : "Hello.ek9",
"startLine" : 8,
"type" : "delete"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"resolvedPath" : "<workspace-root>/Hello.ek9",
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 1,
"lineCount" : 2,
...
Cut short here: 9 more lines. The whole recorded call.
See also
- Show me in the IDE: Toggle Comment, Remove Comment, Reformat