Beispiel #1
0
 protected void WriteRegion(FileLinePositionSpan span)
 {
     // Note that SARIF lines and columns are 1-based, but FileLinePositionSpan is 0-based
     _writer.WriteObjectStart("region");
     _writer.Write("startLine", span.StartLinePosition.Line + 1);
     _writer.Write("startColumn", span.StartLinePosition.Character + 1);
     _writer.Write("endLine", span.EndLinePosition.Line + 1);
     _writer.Write("endColumn", span.EndLinePosition.Character + 1);
     _writer.WriteObjectEnd(); // region
 }
        protected override void WritePhysicalLocation(Location location)
        {
            Debug.Assert(HasPath(location));

            FileLinePositionSpan span = location.GetLineSpan();

            _writer.WriteObjectStart();
            _writer.Write("uri", GetUri(span.Path));

            WriteRegion(span);

            _writer.WriteObjectEnd();
        }
Beispiel #3
0
        protected override void WritePhysicalLocation(Location diagnosticLocation)
        {
            Debug.Assert(HasPath(diagnosticLocation));

            FileLinePositionSpan span = diagnosticLocation.GetLineSpan();

            _writer.WriteObjectStart(); // physicalLocation

            _writer.WriteObjectStart("artifactLocation");
            _writer.Write("uri", GetUri(span.Path));
            _writer.WriteObjectEnd(); // artifactLocation

            WriteRegion(span);

            _writer.WriteObjectEnd();
        }
 internal ExternalFileLocation(string filePath, TextSpan sourceSpan, LinePositionSpan lineSpan)
 {
     _sourceSpan = sourceSpan;
     _lineSpan   = new FileLinePositionSpan(filePath, lineSpan);
 }