private ImmutableArray <PretokenizedDiagnostic> GetErrors(int leadingTriviaWidth)
        {
            if (_diagnostics != null)
            {
                if (leadingTriviaWidth > 0)
                {
                    var array = new PretokenizedDiagnostic[_diagnostics.Count];
                    for (int i = 0; i < _diagnostics.Count; i++)
                    {
                        // fixup error positioning to account for leading trivia
                        array[i] = _diagnostics[i].WithOffset(_diagnostics[i].Offset + leadingTriviaWidth);
                    }

                    return(array.ToImmutableArray());
                }
                else
                {
                    return(_diagnostics.ToImmutableArray());
                }
            }
            else
            {
                return(ImmutableArray <PretokenizedDiagnostic> .Empty);
            }
        }
        public static void Report(this ICollection <PretokenizedDiagnostic> diagnostics, int offset, int width, DiagnosticId diagnosticId, params object[] args)
        {
            var diagnostic = PretokenizedDiagnostic.Create(ShaderLabMessageProvider.Instance, offset, width, (int)diagnosticId, args);

            diagnostics.Add(diagnostic);
        }