File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ export function extractAnnotationsFromCode(code: Code) {
5050 return [ annotations , focusList . join ( "," ) ] as const
5151}
5252
53+ const commentRegex = / \/ \/ \s + ( \w + ) ( \S * ) \s * ( .* ) /
5354function getCommentData ( line : Code [ "lines" ] [ 0 ] ) {
5455 const comment = line . tokens . find ( t =>
5556 t . content . trim ( ) . startsWith ( "//" )
@@ -59,10 +60,13 @@ function getCommentData(line: Code["lines"][0]) {
5960 return { }
6061 }
6162
62- const commentRegex = / \/ \/ \s + ( \w + ) ( \S * ) \s * ( .* ) /
63- const [ , key , focusString , data ] = commentRegex . exec (
64- comment
65- )
63+ const result = commentRegex . exec ( comment )
64+
65+ if ( ! result ) {
66+ return { }
67+ }
68+
69+ const [ , key , focusString , data ] = result
6670
6771 return {
6872 key,
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ function lorem(ipsum, dolor = 1) {
4242}
4343
4444// this comment isn't an annotation
45+ // hello
46+ // 你好
47+ // å
4548function adipiscing (... elit ) {
4649 console .log (elit)
4750 // box[19:36] aqua
You can’t perform that action at this time.
0 commit comments