@@ -24,30 +24,32 @@ export function extractAnnotationsFromCode(code: Code) {
2424 const focusList = [ ] as string [ ]
2525 while ( lineNumber <= lines . length ) {
2626 const line = lines [ lineNumber - 1 ]
27- const { key, focus, data } = getCommentData (
28- line ,
29- lineNumber
30- )
27+ const { key, focusString, data } = getCommentData ( line )
3128
3229 const Component = annotationsMap [ key ! ]
3330
3431 if ( Component ) {
32+ const focus = relativeToAbsolute (
33+ focusString ,
34+ lineNumber
35+ )
3536 lines . splice ( lineNumber - 1 , 1 )
36- annotations . push ( { Component, focus : focus ! , data } )
37+ annotations . push ( { Component, focus, data } )
3738 } else if ( key === "focus" ) {
39+ const focus = relativeToAbsolute (
40+ focusString ,
41+ lineNumber
42+ )
3843 lines . splice ( lineNumber - 1 , 1 )
39- focusList . push ( focus ! )
44+ focusList . push ( focus )
4045 } else {
4146 lineNumber ++
4247 }
4348 }
4449 return [ annotations , focusList . join ( "," ) ] as const
4550}
4651
47- function getCommentData (
48- line : Code [ "lines" ] [ 0 ] ,
49- lineNumber : number
50- ) {
52+ function getCommentData ( line : Code [ "lines" ] [ 0 ] ) {
5153 const comment = line . tokens . find ( t =>
5254 t . content . startsWith ( "//" )
5355 ) ?. content
@@ -63,7 +65,7 @@ function getCommentData(
6365
6466 return {
6567 key,
66- focus : relativeToAbsolute ( focusString , lineNumber ) ,
68+ focusString,
6769 data,
6870 }
6971}
0 commit comments