@@ -288,8 +288,8 @@ func renderSourceAnnotation(code string, sourceFile *ast.SourceFile, textRange c
288288 }
289289 }
290290
291- sl , sc := scanner .GetECMALineAndCharacterOfPosition (sourceFile , startPos )
292- el , ec := scanner .GetECMALineAndCharacterOfPosition (sourceFile , endPos )
291+ sl , sc := scanner .GetECMALineAndUTF16CharacterOfPosition (sourceFile , startPos )
292+ el , ec := scanner .GetECMALineAndUTF16CharacterOfPosition (sourceFile , endPos )
293293
294294 // Display range with 1 line of context
295295 startLine := max (sl - 1 , 0 )
@@ -317,11 +317,11 @@ func renderSourceAnnotation(code string, sourceFile *ast.SourceFile, textRange c
317317 // Calculate annotation columns for this line
318318 aStart := 0
319319 if lineIdx == sl {
320- aStart = sc
320+ aStart = int ( sc )
321321 }
322322 aEnd := len (lineText )
323323 if lineIdx == el {
324- aEnd = ec
324+ aEnd = int ( ec )
325325 }
326326
327327 adjustedStart := adjustForTabs (lineText , aStart )
@@ -397,15 +397,15 @@ func formatDiagnosticsSnapshot(code string, diagnostics []rule.RuleDiagnostic) s
397397 break
398398 }
399399 }
400- lineIdx , colIdx := scanner .GetECMALineAndCharacterOfPosition (d .SourceFile , startPos )
401- line , column = lineIdx + 1 , colIdx + 1
400+ lineIdx , colIdx := scanner .GetECMALineAndUTF16CharacterOfPosition (d .SourceFile , startPos )
401+ line , column = lineIdx + 1 , int ( colIdx ) + 1
402402 // Use inclusive end (last character in range) for display
403403 inclusiveEnd := d .Range .End ()
404404 if inclusiveEnd > startPos {
405405 inclusiveEnd --
406406 }
407- endLineIdx , endColIdx := scanner .GetECMALineAndCharacterOfPosition (d .SourceFile , inclusiveEnd )
408- endLine , endColumn = endLineIdx + 1 , endColIdx + 1
407+ endLineIdx , endColIdx := scanner .GetECMALineAndUTF16CharacterOfPosition (d .SourceFile , inclusiveEnd )
408+ endLine , endColumn = endLineIdx + 1 , int ( endColIdx ) + 1
409409 }
410410
411411 fmt .Fprintf (& sb , "Diagnostic %d: %s (%d:%d - %d:%d)\n " , i + 1 , d .Message .Id , line , column , endLine , endColumn )
@@ -439,15 +439,15 @@ func formatDiagnosticsSnapshot(code string, diagnostics []rule.RuleDiagnostic) s
439439 break
440440 }
441441 }
442- lrLineIdx , lrColIdx := scanner .GetECMALineAndCharacterOfPosition (d .SourceFile , lrStartPos )
443- lrLine , lrCol = lrLineIdx + 1 , lrColIdx + 1
442+ lrLineIdx , lrColIdx := scanner .GetECMALineAndUTF16CharacterOfPosition (d .SourceFile , lrStartPos )
443+ lrLine , lrCol = lrLineIdx + 1 , int ( lrColIdx ) + 1
444444 // Use inclusive end (last character in range) for display
445445 lrInclusiveEnd := lr .Range .End ()
446446 if lrInclusiveEnd > lrStartPos {
447447 lrInclusiveEnd --
448448 }
449- lrEndLineIdx , lrEndColIdx := scanner .GetECMALineAndCharacterOfPosition (d .SourceFile , lrInclusiveEnd )
450- lrEndLine , lrEndCol = lrEndLineIdx + 1 , lrEndColIdx + 1
449+ lrEndLineIdx , lrEndColIdx := scanner .GetECMALineAndUTF16CharacterOfPosition (d .SourceFile , lrInclusiveEnd )
450+ lrEndLine , lrEndCol = lrEndLineIdx + 1 , int ( lrEndColIdx ) + 1
451451 }
452452 fmt .Fprintf (& sb , " Label: %s (%d:%d - %d:%d)\n " , lr .Label , lrLine , lrCol , lrEndLine , lrEndCol )
453453 labelAnnotated := renderSourceAnnotation (code , d .SourceFile , lr .Range , '^' , lr .Label )
0 commit comments