Ace Editor comment start character at beginning of line (before tabs)

Viewed 17

Ace Editor's toggleCommentLines function inserts the lineCommentStart character (for me, an asterisk) at the beginning of the line after any tab characters. I need the comment character to go before the lines. (This is for a Pick / BASIC custom syntax highlighter.)

* Valid comment
*    Valid comment
*      Valid comment 
  * Not valid comment
    * Not valid comment

Could someone please help me out?

1 Answers

The implementation of toggleCommentLines method does not have a way to account for such a syntax. See https://github.com/ajaxorg/ace/blob/c2c749b5e0d5f82c8f8c66ae85b3460d6217cbc6/lib/ace/mode/text.js#L165.

You'll need to either make a pull request adding another property to account for such cases (if there are other languages similar to this), or modify the function to call custom implementation of toggleCommentLines from the mode, if such an implementation is available, and implement the correct behavior in your mode instead.

Related