What is best way to get all the comments in a file


Using the grammar we can get the comment prefix/suffix and multiline comments. But beyond that, is better to go with the regular expression for getting the entire list of comments of the currently opened file or use the tokenizer(how to use tokenizer)


Check out https://atom.io/docs/api/v0.175.0/TextBuffer#instance-scan.