tickgit icon indicating copy to clipboard operation
tickgit copied to clipboard

multiple problems with multiline JS comments

Open masukomi opened this issue 6 years ago • 1 comments

using this JS file

// TODO: a thing
// todo lower case thing
/* foo
TODO: in multiline comment
	TODO tab indented in multiline comment
  TODO: space indented in multiline comment
*/

the output for the multiline section is

TODO: foo
 in multiline comment
	 tab indented in multiline comment
   space indented in multiline comment

problems: a) "foo" has nothing to do with the todo b) leading whitespace shouldn't be displayed c) none of the TODO items are actually highlighted as TODOs like normal output. instead they're under "foo" which isn't even a todo thing.

masukomi avatar Dec 10 '19 20:12 masukomi

Hi @masukomi thanks for bringing up, and apologies for not responding sooner! The behavior you're describing is "expected," but certainly flawed. There's a couple of odd things I'd like to fix up.

  • The entire comment a TODO string is in gets saved as the TODO, hence foo is included in the output, since the entire block comment is saved
  • The TODO string is stripped out of the comment, sometimes making for odd output, especially when the TODO is in the middle of a line or phrase. This displays ok for when TODO starts the comment or line, but as you point out, is bizarre when there's an indent or it appears somewhere else in the comment

I'd like to experiment a bit, but I think with some more sensible parsing within the comment we should be able to clean this up a bit!

patrickdevivo avatar Dec 26 '19 15:12 patrickdevivo