File tree 2 files changed +11
-4
lines changed
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) {
50
50
return [ annotations , focusList . join ( "," ) ] as const
51
51
}
52
52
53
+ const commentRegex = / \/ \/ \s + ( \w + ) ( \S * ) \s * ( .* ) /
53
54
function getCommentData ( line : Code [ "lines" ] [ 0 ] ) {
54
55
const comment = line . tokens . find ( t =>
55
56
t . content . trim ( ) . startsWith ( "//" )
@@ -59,10 +60,13 @@ function getCommentData(line: Code["lines"][0]) {
59
60
return { }
60
61
}
61
62
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
66
70
67
71
return {
68
72
key,
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ function lorem(ipsum, dolor = 1) {
42
42
}
43
43
44
44
// this comment isn't an annotation
45
+ // hello
46
+ // 你好
47
+ // å
45
48
function adipiscing (... elit ) {
46
49
console .log (elit)
47
50
// box[19:36] aqua
You can’t perform that action at this time.
0 commit comments