@@ -2293,13 +2293,29 @@ pub fn getPositionContext(
22932293    } else  if  (lookahead  and  new_index  +  1  <  text .len  and  text [new_index ] ==  '@' ) {
22942294        new_index  +=  2 ;
22952295    }
2296- 
2297-     const  line_loc  =  if  (! lookahead ) offsets .lineLocAtIndex (text , new_index ) else  offsets .lineLocUntilIndex (text , new_index );
2298-     const  line  =  offsets .locToSlice (text , line_loc );
22992296    const  prev_char  =  if  (new_index  >  0 ) text [new_index  -  1 ] else  0 ;
23002297
2301-     const  is_comment  =  std .mem .startsWith (u8 , std .mem .trimLeft (u8 , line , " \t " ), "//" );
2302-     if  (is_comment ) return  .comment ;
2298+     var  line_loc  =  if  (! lookahead ) offsets .lineLocAtIndex (text , new_index ) else  offsets .lineLocUntilIndex (text , new_index );
2299+ 
2300+     var  line  =  offsets .locToSlice (text , line_loc );
2301+     if  (std .mem .startsWith (u8 , std .mem .trimLeft (u8 , line , " \t " ), "//" )) return  .comment ;
2302+ 
2303+     // Check if the (trimmed) line starts with a '.', ie a continuation 
2304+     while  (std .mem .startsWith (u8 , std .mem .trimLeft (u8 , text [line_loc .start .. line_loc .end ], " \t \r " ), "." )) {
2305+         if  (line_loc .start  >  1 ) {
2306+             line_loc .start  -=  2 ; // jump over a (potential) preceding '\n' 
2307+         } else  break ;
2308+         while  (line_loc .start  >  0 ) : (line_loc .start  -=  1 ) {
2309+             if  (text [line_loc .start ] ==  '\n ' ) {
2310+                 line_loc .start  +=  1 ; // eat the `\n` 
2311+                 break ;
2312+             }
2313+         } else  break ;
2314+     }
2315+ 
2316+     // Did we end up at a comment? 
2317+     line  =  offsets .locToSlice (text , line_loc );
2318+     if  (std .mem .startsWith (u8 , std .mem .trimLeft (u8 , line , " \t " ), "//" )) return  .other ;
23032319
23042320    var  stack  =  try  std .ArrayListUnmanaged (StackState ).initCapacity (allocator , 8 );
23052321    defer  stack .deinit (allocator );
0 commit comments