File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,9 @@ class CodeByteOffsets {
15
15
16
16
public lineToOffsets ( line : number ) {
17
17
const precedingBytes = this . bytesBeforeLine ( line ) ;
18
+ const nextPrecedingBytes = this . bytesBeforeLine ( line + 1 ) ;
18
19
19
- const highlightedLine = this . lines [ line ] ;
20
- const highlightedBytes = highlightedLine . length ;
21
-
22
- return [ precedingBytes , precedingBytes + highlightedBytes ] ;
20
+ return [ precedingBytes , nextPrecedingBytes ] ;
23
21
}
24
22
25
23
public rangeToOffsets ( start : Position , end : Position ) {
@@ -40,7 +38,7 @@ class CodeByteOffsets {
40
38
const precedingLines = this . lines . slice ( 0 , line ) ;
41
39
42
40
// Add one to account for the newline we split on and removed
43
- return precedingLines . map ( ( l ) => l . length + 1 ) . reduce ( ( a , b ) => a + b ) ;
41
+ return precedingLines . map ( ( l ) => l . length + 1 ) . reduce ( ( a , b ) => a + b , 0 ) ;
44
42
}
45
43
}
46
44
You can’t perform that action at this time.
0 commit comments