ek9_remove_comments
Deletes one whole-line comment block (//, <!- -!>, <!-- --> or <?- -?>) in full; answers status and edits[] (one DELETE per line), or conflicts[] (kind 'comment-shares-line-with-code') when a boundary line also carries code.
When to use it
'Drop the //AI: comment in orders.ek9' is one call with file + symbol:'AI' (a word from the comment) or line (any line inside it) - the tool expands to the whole block. Use it on a stale whole-line comment: an acted-on instruction, or a <?- -?>/<!- -!> block whose target was removed.
When not to use it
- Removing CODE statements, not comments - use
ek9_remove_statements(comments live on the HIDDEN ANTLR channel that remove_statements does not touch). - Stripping a TRAILING comment from a code-bearing line (e.g. `x <- 10 //note`) — V1 refuses with comment-shares-line-with-code; use
ek9_edit_fileline-replace. - Removing many comments at once or reshaping the file beyond comment removal — use
ek9_write_file(overwrite) as the read+rewrite escape hatch.
Details
summary names the comment form removed: line-comment / block-comment / block-comment-html / doc-comment; edits are one DELETE per resolved line. A comment whose first or last line also carries code outside the delimiters returns status:'conflicts' (kind comment-shares-line-with-code).
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
file | string | yes | Workspace-relative path to the .ek9 source file containing the comment. |
line | integer | Any 1-based line inside the comment - the tool expands to the full extent of the block via the ANTLR token stream. OMIT it and pass symbol:'<word>' to let the tool find the line. | |
symbol | string | A word from the comment's text (e.g. 'AI' from '//AI: ...'); the first line carrying it as a whole word anchors the call. Pass line instead when the word also occurs in code. |
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 line comment apply
Request
{
"file" : "Hello.ek9",
"line" : 6
}
Response
{
"conflicts" : [ ],
"edits" : [ {
"before" : " // drop me",
"endLine" : 6,
"file" : "Hello.ek9",
"startLine" : 6,
"type" : "delete"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"resolvedPath" : "<workspace-root>/Hello.ek9",
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 1,
"lineCount" : 1,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "applied",
"summary" : "Removed line-comment on line 6",
"workspaceHash" : "<workspace-hash>",
...
Cut short here: 3 more lines. The whole recorded call.
See also
- Show me in the IDE: Toggle Comment, Remove Comment, Reformat