| 1405 | |
| 1406 | const handleComment = (commentStr) => { |
| 1407 | const toggleComment = (line) => { |
| 1408 | const indentation = line.match(leadingSpacesRegex)[0] || ""; |
| 1409 | const content = line.slice(indentation.length); |
| 1410 | |
| 1411 | if (content.startsWith(commentStr + " ")) { |
| 1412 | return { |
| 1413 | line: indentation + content.slice(commentStr.length + 1), |
| 1414 | offset: -(commentStr.length + 1), |
| 1415 | }; |
| 1416 | } else if (content.startsWith(commentStr)) { |
| 1417 | return { |
| 1418 | line: indentation + content.slice(commentStr.length), |
| 1419 | offset: -commentStr.length, |
| 1420 | }; |
| 1421 | } else { |
| 1422 | return { |
| 1423 | line: indentation + commentStr + " " + content, |
| 1424 | offset: commentStr.length + 1, |
| 1425 | }; |
| 1426 | } |
| 1427 | }; |
| 1428 | |
| 1429 | const isCommented = (line) => { |
| 1430 | const content = line.slice( |