Lines Matching full:comments
11 # Trying to parse JSON comments and then being able to re-insert them into
15 # - Single-line style comments (//) can be on a new line or at the end of
18 # - Multi-line style comments (/* */) use the must be free-standing.
20 # - Comments will get inserted back into the file in the line they came
24 # - No attempts to re-indent multi-line comments will be made.
27 # prettier before using this script and planning to move multi-line comments
38 self.comments: List[Tuple[bool, int, str]] = []
40 # Extract out the comments from a JSON-like string and save them away.
52 self.comments.append((do_append, idx, single.group(0)))
69 self.comments.append(
77 # Re-insert the saved off comments into a JSON-like string.
81 for append, idx, string in self.comments:
105 comments = CommentTracker() variable
108 j = json.loads(comments.extract_comments(fp.read()))
121 fp.write(comments.insert_comments(contents))